HUGO
News Docs Themes Community GitHub

Configure page

Configure page behavior.
New in v0.133.0

The default sort order for page collections, used when no other criteria are set, follows this priority:

  1. weight (ascending)
  2. date (descending)
  3. linkTitle falling back to title (ascending)
  4. logical path (ascending)

Hugo uses the default sort order to determine the next and previous page relative to the current page when calling these methods on a Page object:

This is based on this default site configuration:

page:
  nextPrevInSectionSortOrder: desc
  nextPrevSortOrder: desc
[page]
  nextPrevInSectionSortOrder = 'desc'
  nextPrevSortOrder = 'desc'
{
   "page": {
      "nextPrevInSectionSortOrder": "desc",
      "nextPrevSortOrder": "desc"
   }
}

To reverse the meaning of next and previous:

page:
  nextPrevInSectionSortOrder: asc
  nextPrevSortOrder: asc
[page]
  nextPrevInSectionSortOrder = 'asc'
  nextPrevSortOrder = 'asc'
{
   "page": {
      "nextPrevInSectionSortOrder": "asc",
      "nextPrevSortOrder": "asc"
   }
}

These settings do not apply to the Next or Prev methods on a Pages object.