Back to Hugo

ByLastmod

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

0.161.1498 B
Original Source

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

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

To sort in descending order:

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