Exemplo n.º 1
0
Arquivo: news.go Projeto: 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)
	})
}
Exemplo n.º 2
0
Arquivo: news.go Projeto: 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)
	})
}