Back to Hugo

ByDate

docs/content/en/methods/pages/ByDate.md

0.163.0471 B
Original Source

When sorting by date, the value is determined by your project configuration, defaulting to the date field in front matter.

go-html-template
{{ range .Pages.ByDate }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}

To sort in descending order:

go-html-template
{{ range .Pages.ByDate.Reverse }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}