Paginator
文法
PAGE.Paginator
戻り値
page.Pager
[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers.
The number of elements on each pager is determined by your site configuration. The default is 10.
You can invoke pagination on the home template, section templates, taxonomy templates, and term templates. Each of these receives a collection of regular pages in context. When you invoke the Paginator method, it paginates the page collection received in context.
layouts/_default/list.html
{{ range .Paginator.Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
{{ template "_internal/pagination.html" . }}In the example above, the embedded pagination template creates navigation links between pagers.