pages.md (1117B)
1 ---
2 title: Pages Methods
3 linktitle:
4 description: Pages is the core page collection in Hugo and has many useful methods.
5 date: 2019-10-20
6 categories: [variables and params]
7 keywords: [pages]
8 draft: false
9 menu:
10 docs:
11 title: "methods defined on a page collection"
12 parent: "variables"
13 weight: 21
14 weight: 21
15 sections_weight: 20
16 aliases: [/pages]
17 toc: true
18 ---
19
20 Also see [List templates](/templates/lists) for an overview of sort methods.
21
22 ## .Next PAGE
23
24 `.Next` and `.Prev` on `Pages` work similar to the methods with the same names on `.Page`, but are more flexible (and slightly slower) as they can be used on any page collection.
25
26 `.Next` points **up** to the next page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Next . }}{{.RelPermalink}}{{end}}`. Calling `.Next` with the first page in the collection returns `nil`.
27
28 ## .Prev PAGE
29
30 `.Prev` points **down** to the previous page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Prev . }}{{.RelPermalink}}{{end}}`. Calling `.Prev` with the last page in the collection returns `nil`.