diff options
| author | a73x <[email protected]> | 2024-08-25 15:14:42 +0100 |
|---|---|---|
| committer | a73x <[email protected]> | 2024-08-25 15:14:42 +0100 |
| commit | 9747eaa84f3cbec2267317fd98cda991c427f190 (patch) | |
| tree | 8d6b54895ae5766b60747cdf367c4181fc462938 /cmd/home | |
| parent | 2e2ccfc8a9cd73d316149b67c875545891c5dada (diff) | |
post 3
Diffstat (limited to 'cmd/home')
| -rw-r--r-- | cmd/home/main.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/home/main.go b/cmd/home/main.go index 01bddee..5a4573f 100644 --- a/cmd/home/main.go +++ b/cmd/home/main.go @@ -77,8 +77,15 @@ func GeneratePosts(mux *http.ServeMux) ([]PostData, error) { return nil, fmt.Errorf("failed to read post template: %v", err) } + type IPostData struct { + Title string + Post string + } mux.HandleFunc("/posts/"+postName, func(w http.ResponseWriter, r *http.Request) { - if err := foo.ExecuteTemplate(w, "post.html", string(content)); err != nil { + if err := foo.ExecuteTemplate(w, "post.html", IPostData{ + Title: meta["title"], + Post: string(content), + }); err != nil { fmt.Println(err) } }) |
