hugoDocs/content/en/_common/permalink-tokens.md
Joe Mooring 3b9c3e2a1f
content: Miscellaneous updates related to v0.149.0
- Refresh docs.yaml
- Add new-in labels to new permalink tokens
- Remove outdated new-in labels
2025-08-27 10:37:39 -07:00

3.3 KiB

_comment
Do not remove front matter.
:year
The 4-digit year as defined in the front matter date field.
:month
The 2-digit month as defined in the front matter date field.
:monthname
The name of the month as defined in the front matter date field.
:day
The 2-digit day as defined in the front matter date field.
:weekday
The 1-digit day of the week as defined in the front matter date field (Sunday = 0).
:weekdayname
The name of the day of the week as defined in the front matter date field.
:yearday
The 1- to 3-digit day of the year as defined in the front matter date field.
:section
The content's section.
:sectionslug
{{< new-in 0.149.0 />}}
The content's section using slugified section name. The slugified section name is the slug as defined in front matter, else the title as defined in front matter, else the automatic title.
:sections
The content's sections hierarchy. You can use a selection of the sections using slice syntax: :sections[1:] includes all but the first, :sections[:last] includes all but the last, :sections[last] includes only the last, :sections[1:2] includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
:sectionslugs
{{< new-in 0.149.0 />}}
The content's sections hierarchy using slugified section names. The slugified section name is the slug as defined in front matter, else the title as defined in front matter, else the automatic title. You can use a selection of the sections using slice syntax: :sectionslugs[1:] includes all but the first, :sectionslugs[:last] includes all but the last, :sectionslugs[last] includes only the last, :sectionslugs[1:2] includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
:title
The title as defined in front matter, else the automatic title. Hugo generates titles automatically for section, taxonomy, and term pages that are not backed by a file.
:slug
The slug as defined in front matter, else the title as defined in front matter, else the automatic title. Hugo generates titles automatically for section, taxonomy, and term pages that are not backed by a file.
:filename
The content's file name without extension, applicable to the page page kind.

{{< deprecated-in v0.144.0 >}} The :filename token has been deprecated. Use :contentbasename instead. {{< /deprecated-in >}}

:slugorfilename
The slug as defined in front matter, else the content's file name without extension, applicable to the page page kind.

{{< deprecated-in v0.144.0 >}} The :slugorfilename token has been deprecated. Use :slugorcontentbasename instead. {{< /deprecated-in >}}

:contentbasename
{{< new-in 0.144.0 />}}
The content base name.
:slugorcontentbasename
{{< new-in 0.144.0 />}}
The slug as defined in front matter, else the content base name.

For time-related values, you can also use the layout string components defined in Go's time package. For example:

{{< code-toggle file=hugo >}} permalinks: posts: /:06/:1/:2/:title/ {{< /code-toggle >}}