示例#1
0
文件: news.go 项目: fd/simplex
func generate_article_pages(articles *static.C) {
	shttp.Render(articles, func(article *Article, w shttp.Writer) error {
		w.Path(fmt.Sprintf("/articles/%d", article.Id))

		return article_tmpl.Execute(w, article)
	})
}
示例#2
0
文件: news.go 项目: fd/simplex
func generate_index_pages(articles *static.C) {
	index_pages := paginate.Paginate(articles, 50)

	shttp.Render(index_pages, func(page *paginate.Page, w shttp.Writer) error {
		if page.Number == 1 {
			w.Path("/articles")
		}

		w.Path(fmt.Sprintf("/articles/page-%d", page.Number))

		return index_tmpl.Execute(w, page)
	})
}