Debian Codegraph @

docs/content/en/methods/page/ExpiryDate.md

raw
1 ---
2 title: ExpiryDate
3 description: Returns the expiry date of the given page.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: time.Time
9 signatures: [PAGE.ExpiryDate]
10 ---
11
12 By default, Hugo excludes expired pages when building your project. To include expired pages, use the `--buildExpired` command line flag.
13
14 Set the expiry date in front matter:
15
16 {{< code-toggle file=content/news/article-1.md fm=true >}}
17 title = 'Article 1'
18 expiryDate = 2024-10-19T00:32:13-07:00
19 {{< /code-toggle >}}
20
21 The expiry date is a [time.Time][] value. Format and localize the value with the [`time.Format`][] function, or use it with any of the [time methods][].
22
23 ```go-html-template
24 {{ .ExpiryDate | time.Format ":date_medium" }} → Oct 19, 2024
25 ```
26
27 In the example above we explicitly set the expiry date in front matter. With Hugo's default configuration, the `ExpiryDate` method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the expiry date is not defined in front matter. See [details][].
28
29 [`time.Format`]: /functions/time/format/
30 [details]: /configuration/front-matter/#dates
31 [time methods]: /methods/time/
32 [time.Time]: https://pkg.go.dev/time#Time