| 1 |
--- |
| 2 |
title: NumberOfElements |
| 3 |
description: Returns the number of pages in the current pager. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: int |
| 9 |
signatures: [PAGER.NumberOfElements] |
| 10 |
--- |
| 11 |
|
| 12 |
```go-html-template |
| 13 |
{{ $pages := where site.RegularPages "Type" "posts" }} |
| 14 |
{{ $paginator := .Paginate $pages }} |
| 15 |
|
| 16 |
{{ range $paginator.Pages }} |
| 17 |
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> |
| 18 |
{{ end }} |
| 19 |
|
| 20 |
{{ with $paginator }} |
| 21 |
{{ .NumberOfElements }} |
| 22 |
{{ end }} |
| 23 |
``` |