mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'
This commit is contained in:
29
docs/content/en/methods/pager/PageGroups.md
Normal file
29
docs/content/en/methods/pager/PageGroups.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: PageGroups
|
||||
description: Returns the page groups in the current pager.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/Paginate
|
||||
returnType: page.PagesGroup
|
||||
signatures: [PAGER.PageGroups]
|
||||
---
|
||||
|
||||
Use the `PageGroups` method with any of the [grouping methods].
|
||||
|
||||
[grouping methods]: /quick-reference/page-collections/#group
|
||||
|
||||
```go-html-template
|
||||
{{ $pages := where site.RegularPages "Type" "posts" }}
|
||||
{{ $paginator := .Paginate ($pages.GroupByDate "Jan 2006") }}
|
||||
|
||||
{{ range $paginator.PageGroups }}
|
||||
<h2>{{ .Key }}</h2>
|
||||
{{ range .Pages }}
|
||||
<h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
```
|
Reference in New Issue
Block a user