mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03:00
resources/page: Revise the new contentbasename permalinks tokens
* Make it work for all pages, including those created from content adapters and not backed by a file. * Allow the `slug` to win, so the new tokens are: `:contentbasename`: 1. ContentBaseName `:slugorcontentbasename`: 1. Slug 2. ContentBaseName Note that a page will always have a `ContentBaseName`, so no need to fall back to e.g. the title. Closes #11722
This commit is contained in:
parent
cb7a4339b7
commit
7b7a0f3624
6 changed files with 145 additions and 60 deletions
|
@ -317,14 +317,6 @@ Use these tokens when defining the URL pattern. You can also use these tokens wh
|
|||
`:slugorfilename`
|
||||
: The slug as defined in front matter, else the content's file name without extension, applicable to the `page` page kind.
|
||||
|
||||
`:contentbasename`
|
||||
: The content base name, as defined in [`File.ContentBaseName`], applicable to pages backed by a file.
|
||||
|
||||
`:contentbasenameorslug`
|
||||
: The content base name, else the slug as defined above.
|
||||
|
||||
[`File.ContentBaseName`]: /methods/page/file/#contentbasename
|
||||
|
||||
For time-related values, you can also use the layout string components defined in Go's [time package]. For example:
|
||||
|
||||
[time package]: https://pkg.go.dev/time#pkg-constants
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue