diff --git a/embed/post-list.html b/embed/post-list.html index e69de29..232dd64 100644 --- a/embed/post-list.html +++ b/embed/post-list.html @@ -0,0 +1,3 @@ +{{range .}} +

{{.Title}}

+{{end}} \ No newline at end of file diff --git a/renderer.go b/renderer.go index 8a255d7..c2babcc 100644 --- a/renderer.go +++ b/renderer.go @@ -86,9 +86,9 @@ func RenderPost(post Post) (string, error) { func RenderIndexPage(user User) (string, error) { posts, _ := user.Posts() - postHtml := "" - for _, post := range posts { - postHtml += "

" + post.Title() + "

\n" + postHtml, err := renderEmbedTemplate("embed/post-list.html", posts) + if err != nil { + return "", err } data := PageContent{