| 1 |
--- |
| 2 |
title: PagerSize |
| 3 |
description: Returns the number of pages per pager. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: int |
| 9 |
signatures: [PAGER.PagerSize] |
| 10 |
aliases: [/methods/pager/pagesize/] |
| 11 |
--- |
| 12 |
|
| 13 |
The number of pages per pager is determined by the optional second argument passed to the [`Paginate`][] method, falling back to the `pagerSize` as defined in your [project configuration][]. |
| 14 |
|
| 15 |
```go-html-template |
| 16 |
{{ $pages := where site.RegularPages "Type" "posts" }} |
| 17 |
{{ $paginator := .Paginate $pages }} |
| 18 |
|
| 19 |
{{ range $paginator.Pages }} |
| 20 |
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> |
| 21 |
{{ end }} |
| 22 |
|
| 23 |
{{ with $paginator }} |
| 24 |
{{ .PagerSize }} |
| 25 |
{{ end }} |
| 26 |
``` |
| 27 |
|
| 28 |
[`Paginate`]: /methods/page/paginate/ |
| 29 |
[project configuration]: /templates/pagination/#configuration |