Debian Codegraph @

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

raw
1 ---
2 title: ByExpiryDate
3 description: Returns the given page collection sorted by expiration date in ascending order.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.Pages
9 signatures: [PAGES.ByExpiryDate]
10 ---
11
12 When sorting by expiration date, the value is determined by your [project configuration][], defaulting to the `expiryDate` field in front matter.
13
14 ```go-html-template
15 {{ range .Pages.ByExpiryDate }}
16 <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
17 {{ end }}
18 ```
19
20 To sort in descending order:
21
22 ```go-html-template
23 {{ range .Pages.ByExpiryDate.Reverse }}
24 <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
25 {{ end }}
26 ```
27
28 [project configuration]: /configuration/front-matter/#dates