示例#1
0
func RenderBlogIndex(w http.ResponseWriter, req *http.Request) {
	indexTemplate.Execute(w, struct {
		Entries []models.BlogEntry
		Title   string
	}{
		models.NewEntries(12),
		"",
	})
}
示例#2
0
func RenderBlogPage(bp models.BlogEntry, w http.ResponseWriter) {
	entryTemplate.Execute(w, struct {
		Entry      models.BlogEntry
		NewEntries []models.BlogEntry
		Categories []models.Category
	}{
		bp,
		models.NewEntries(3),
		models.ActiveCategories(),
	})
}