mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'
This commit is contained in:
30
docs/content/en/methods/pager/Pagers.md
Normal file
30
docs/content/en/methods/pager/Pagers.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: Pagers
|
||||
description: Returns the pagers collection.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/Paginate
|
||||
returnType: page.pagers
|
||||
signatures: [PAGER.Pagers]
|
||||
---
|
||||
|
||||
Use the `Pagers` method to build navigation between pagers.
|
||||
|
||||
```go-html-template
|
||||
{{ $pages := where site.RegularPages "Type" "posts" }}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
|
||||
{{ range $paginator.Pages }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
|
||||
{{ with $paginator }}
|
||||
<ul>
|
||||
{{ range .Pagers }}
|
||||
<li><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
```
|
Reference in New Issue
Block a user