Back to Hugo

ByExpiryDate

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

0.161.1500 B
Original Source

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

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

To sort in descending order:

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