Debian Codegraph @

docs/content/en/methods/pager/Last.md

raw
1 ---
2 title: Last
3 description: Returns the last pager in the pager collection.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.Pager
9 signatures: [PAGER.Last]
10 ---
11
12 Use the `Last` method to build navigation between pagers.
13
14 ```go-html-template
15 {{ $pages := where site.RegularPages "Type" "posts" }}
16 {{ $paginator := .Paginate $pages }}
17
18 {{ range $paginator.Pages }}
19 <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
20 {{ end }}
21
22 {{ with $paginator }}
23 <ul>
24 {{ with .First }}
25 <li><a href="{{ .URL }}">First</a></li>
26 {{ end }}
27 {{ with .Prev }}
28 <li><a href="{{ .URL }}">Previous</a></li>
29 {{ end }}
30 {{ with .Next }}
31 <li><a href="{{ .URL }}">Next</a></li>
32 {{ end }}
33 {{ with .Last }}
34 <li><a href="{{ .URL }}">Last</a></li>
35 {{ end }}
36 </ul>
37 {{ end }}
38 ```