use template for post list
This commit is contained in:
parent
a9e83e1c60
commit
3c6df116fa
|
@ -0,0 +1,3 @@
|
|||
{{range .}}
|
||||
<h2><a href="{{.UrlPath}}">{{.Title}}</a></h2>
|
||||
{{end}}
|
|
@ -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 += "<h2><a href=\"" + post.UrlPath() + "\">" + post.Title() + "</a></h2>\n"
|
||||
postHtml, err := renderEmbedTemplate("embed/post-list.html", posts)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
data := PageContent{
|
||||
|
|
Loading…
Reference in New Issue