Page collections
A quick reference guide to Hugo’s page collections.
Page
Use these Page
methods when rendering lists on section pages, taxonomy pages, term pages, and the home page.
- PAGE.Pages
- Returns a collection of regular pages within the current section, and section pages of immediate descendant sections.
- PAGE.RegularPages
- Returns a collection of regular pages within the current section.
- PAGE.RegularPagesRecursive
- Returns a collection of regular pages within the current section, and regular pages within all descendant sections.
- PAGE.Sections
- Returns a collection of section pages, one for each immediate descendant section of the given page.
Site
Use these Site
methods when rendering lists on any page.
- SITE.AllPages
- Returns a collection of all pages in all languages.
- SITE.Pages
- Returns a collection of all pages.
- SITE.RegularPages
- Returns a collection of all regular pages.
- SITE.Sections
- Returns a collection of top-level section pages.
Filter
Use the where
function to filter page collections.
Sort
The default sort order for page collections, used when no other criteria are set, follows this priority:
weight
(ascending)date
(descending)linkTitle
falling back totitle
(ascending)- logical path (ascending)
Use these methods to sort page collections by different criteria.
- PAGES.ByDate
- Returns the given page collection sorted by date in ascending order.
- PAGES.ByExpiryDate
- Returns the given page collection sorted by expiration date in ascending order.
- PAGES.ByLanguage
- Returns the given page collection sorted by language in ascending order.
- PAGES.ByLastmod
- Returns the given page collection sorted by last modification date in ascending order.
- PAGES.ByLength
- Returns the given page collection sorted by content length in ascending order.
- PAGES.ByLinkTitle
- Returns the given page collection sorted by link title in ascending order, falling back to title if link title is not defined.
- PAGES.ByParam
- Returns the given page collection sorted by the given parameter in ascending order.
- PAGES.ByPublishDate
- Returns the given page collection sorted by publish date in ascending order.
- PAGES.ByTitle
- Returns the given page collection sorted by title in ascending order.
- PAGES.ByWeight
- Returns the given page collection sorted by weight in ascending order.
- PAGES.Reverse
- Returns the given page collection in reverse order.
Group
Use these methods to group page collections.
- PAGES.GroupBy
- Returns the given page collection grouped by the given field in ascending order.
- PAGES.GroupByDate
- Returns the given page collection grouped by date in descending order.
- PAGES.GroupByExpiryDate
- Returns the given page collection grouped by expiration date in descending order.
- PAGES.GroupByLastmod
- Returns the given page collection grouped by last modification date in descending order.
- PAGES.GroupByParam
- Returns the given page collection grouped by the given parameter in ascending order.
- PAGES.GroupByParamDate
- Returns the given page collection grouped by the given date parameter in descending order.
- PAGES.GroupByPublishDate
- Returns the given page collection grouped by publish date in descending order.
- PAGES.Reverse
- Returns the given page collection in reverse order.