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 first level section pages.
Filter
Use the where
function to filter page collections.
Sort
By default, Hugo sorts page collections by:
- Weight
- Date in descending order
- LinkTitle falling back to Title
- Filename if the page is backed by a file
Use these methods to sort page collections.
- 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.