mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-26 21:51:29 +00:00
5fd1e74903
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
1.6 KiB
1.6 KiB
The Next
and Prev
methods on a Pages
object are more flexible than the Next
and Prev
methods on a Page
object.
Page collection | Custom sort order | |
---|---|---|
PAGES.Next and PAGES.Prev |
locally defined | ✔️ |
PAGE.Next and PAGE.Prev |
globally defined | ❌ |
- locally defined
- Build the page collection every time you call
PAGES.Next
andPAGES.Prev
. Navigation between pages is relative to the current page's position within the local collection, independent of the global collection.
With a local collection, the navigation sort order is the same as the collection sort order.
- globally defined
- Build the page collection once, on a list page. Navigation between pages is relative to the current page's position within the global collection.
With a global collection, the navigation sort order is fixed, using Hugo's default sort order. In order of precedence:
- Page weight
- Page date (descending)
- Page linkTitle, falling back to page title
- Page file path if the page is backed by a file
For example, with a global collection sorted by title, the navigation sort order will use Hugo's default sort order. This is probably not what you want or expect. For this reason, the Next
and Prev
methods on a Pages
object are generally a better choice.