Debian Codegraph @

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

raw
1 ---
2 title: PageGroups
3 description: Returns the page groups in the current pager.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.PagesGroup
9 signatures: [PAGER.PageGroups]
10 ---
11
12 Use the `PageGroups` method with any of the [grouping methods][].
13
14 ```go-html-template
15 {{ $pages := where site.RegularPages "Type" "posts" }}
16 {{ $paginator := .Paginate ($pages.GroupByDate "Jan 2006") }}
17
18 {{ range $paginator.PageGroups }}
19 <h2>{{ .Key }}</h2>
20 {{ range .Pages }}
21 <h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
22 {{ end }}
23 {{ end }}
24
25 {{ partial "pagination.html" . }}
26 ```
27
28 [grouping methods]: /quick-reference/page-collections/#group