HUGO
Menu
GitHub 90437 stars Mastodon

RegularPages

Returns a collection of all regular pages.
Syntax
SITE.RegularPages
Returns
page.Pages

The RegularPages method on a Site object returns a collection of all regular pages, in the default sort order.

{{ range site.RegularPages }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}

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. Path relative to the content directory, including the file extension and any language identifier, converted to lower case with spaces replaced by hyphens (ascending)

default sort order

To change the sort order, use any of the Pages sorting methods. For example:

{{ range site.RegularPages.ByTitle }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}