Skip to content

Commit

Permalink
Updated lib example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kugelschieber committed Jun 4, 2024
1 parent 5368c20 commit cd08416
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,15 @@ func main() {
customFuncMap := template.FuncMap{
"blogArticle": loadAndRenderBlogArticle,
}

// Start Shifu from the content/dir directory and pass your own template.FuncMap.
// The FuncMap will be merged with the default FuncMap of Shifu.
if err := shifu.Start("content/dir", customFuncMap); err != nil {

// Set up Shifu from the content/dir directory and pass your own template.FuncMap.
// The FuncMap will be merged with the default FuncMap of Shifu.
server := shifu.NewServer("content/dir", shifu.ServerOptions{
FuncMap: customFuncMap,
})

// Start the server. The router and cancel function are optional.
if err := server.Start(nil, nil); err != nil {
slog.Error("Error starting Shifu", "error", err)
}
}
Expand Down

0 comments on commit cd08416

Please sign in to comment.