diff options
Diffstat (limited to 'docs/content/en/content-management/urls.md')
-rw-r--r-- | docs/content/en/content-management/urls.md | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/docs/content/en/content-management/urls.md b/docs/content/en/content-management/urls.md index a91fe21c0..9dbeed12a 100644 --- a/docs/content/en/content-management/urls.md +++ b/docs/content/en/content-management/urls.md @@ -89,12 +89,10 @@ If you set both `slug` and `url` in front matter, the `url` value takes preceden ### Permalinks -In your site configuration, define a URL pattern for each top-level section. Each URL pattern can target a given language and/or [page kind]. +In your site configuration, define a URL pattern for each top-level section. Each URL pattern can target a given language and/or page kind. Front matter `url` values override the URL patterns defined in the `permalinks` section of your site configuration. -[page kind]: /templates/section-templates/#page-kinds - #### Monolingual examples {#permalinks-monolingual-examples} With this content structure: @@ -235,46 +233,46 @@ public/ #### Tokens -Use these tokens when defining the URL pattern. The `date` field in front matter determines the value of time-related tokens. +Use these tokens when defining the URL pattern. `:year` -: the 4-digit year +: The 4-digit year as defined in the front matter `date` field. `:month` -: the 2-digit month +: The 2-digit month as defined in the front matter `date` field. `:monthname` -: the name of the month +: The name of the month as defined in the front matter `date` field. `:day` -: the 2-digit day +: The 2-digit day as defined in the front matter `date` field. `:weekday` -: the 1-digit day of the week (Sunday = 0) +: 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 +: 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 +: The 1- to 3-digit day of the year as defined in the front matter `date` field. `:section` -: the content's section +: The content's section. `: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. +: 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. `:title` -: the content's 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 content's slug (or title if no slug is provided in the front matter) - -`:slugorfilename` -: the content's slug (or file name if no slug is provided in the front matter) +: 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) +: The content's file name without extension, applicable to the `page` page kind. + +`:slugorfilename` +: The slug as defined in front matter, else the content's file name without extension, applicable to the `page` page kind. For time-related values, you can also use the layout string components defined in Go's [time package]. For example: @@ -307,7 +305,7 @@ Hugo provides two mutually exclusive configuration options to alter URLs _after_ #### Canonical URLs {{% note %}} -This is a legacy configuration option, superseded by template functions and markdown render hooks, and will likely be [removed in a future release]. +This is a legacy configuration option, superseded by template functions and Markdown render hooks, and will likely be [removed in a future release]. [removed in a future release]: https://github.com/gohugoio/hugo/issues/4733 {{% /note %}} @@ -423,10 +421,12 @@ Hugo renders alias files before rendering pages. A new page with the previous fi ### Customize -Create a new template (`layouts/alias.html`) to customize the content of the alias files. The template receives the following context: +To override Hugo's embedded `alias` template, copy the [source code] to a file with the same name in the layouts directory. The template receives the following context: Permalink -: the link to the page being aliased +: The link to the page being aliased. Page -: the Page data for the page being aliased +: The Page data for the page being aliased. + +[source code]: {{% eturl alias %}} |