// templates/index.go package templates import ( "bytes" "fmt" "time" ) // PostSnippet represents data needed for the index list type PostSnippet struct { Title string URL string Date time.Time } // RenderLatestPosts generates the HTML for the list of recent posts. // It accepts a list of posts (already sorted). func RenderLatestPosts(posts []PostSnippet) string { var buf bytes.Buffer buf.WriteString(`

Latest Posts

`) return buf.String() } // RenderDirectoryLink generates the navigation link to the full archive. func RenderDirectoryLink() string { return `` } // RenderSiteHeadline generates the top banner. func RenderSiteHeadline(text string) string { return fmt.Sprintf(`

%s

`, text) }