Template functions · Pages
paginate
Split a list across numbered pages.
paginate n listReturns the items for the page being rendered and generates the extra pages: a listing at /blog gets /blog/2, /blog/3 and so on. Use it once per page.
Read the position from .Source.CurrentPage and .Source.TotalPages, and build links with pages.
Example
{{ $posts := sort "Meta.date" "desc" (sources "RelPath" "blog/*") }}
{{ range paginate 10 $posts }}
<h2>{{ .Meta.title }}</h2>
{{ end }}
Page {{ .Source.CurrentPage }} of {{ .Source.TotalPages }}Other functions
data
sources
sort
filter
limit
offset
select
pages
page
path
hash
json
contains
html
js
css