-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
v0.153.0 has changed the behavior of the tokens :contentbasename and :slugcontentbasename as resolution of #14104. Sorry that I missed the ping on that issue, otherwise we could've caught this before.
The new behavior breaks my website, and it seems to be against what's documented and what has been discussed and agreed upon before on issue #11722. It was known that it'd be different than :filename and give the directory name for bundles with _index.md pages. It's also documented on https://gohugo.io/methods/page/file/#contentbasename (linked from https://gohugo.io/configuration/permalinks/#contentbasename):
ContentBaseName
(string) If the page is a branch or leaf bundle, the name of the containing directory, else the TranslationBaseName.
For testing, you can just use my website. Here's the relevant taxonomy configuration: https://github.com/hacdias/hacdias.com/blob/9e91c45e7dda87979f3e0e1e7c62a32056d1a4f8/config.toml#L17-L21
All "categories" build to "/" now and all "tags" build to "/tags":
WARN Duplicate target paths: /feed.json (3), /feed.xml (3), /index.html (3), /page/10/index.html (2), /page/11/index.html (2), /page/12/index.html (2), /page/13/index.html (2), /page/14/index.html (2), /page/15/index.html (2), /page/16/index.html (2), /page/17/index.html (2), /page/18/index.html (2), /page/19/index.html (2), /page/2/index.html (2), /page/20/index.html (2), /page/21/index.html (2), /page/22/index.html (2), /page/23/index.html (2), /page/24/index.html (2), /page/3/index.html (2), /page/4/index.html (2), /page/5/index.html (2), /page/6/index.html (2), /page/7/index.html (2), /page/8/index.html (2), /page/9/index.html (2), /styles.css (2), /tags/feed.json (27), /tags/feed.xml (27), /tags/index.html (28), page/1/index.html (2), tags/page/1/index.html (26)
So I'm not really sure why the change, and the only alternative seems to manually set a slug for all of these taxonomies, which is time consuming.
I'd argue that #14126 should be reverted since it doesn't match the documentation and the decision in #11722.
What version of Hugo are you using (hugo version)?
$ hugo version hugo v0.153.4+extended+withdeploy darwin/arm64 BuildDate=2025-12-28T21:34:16Z VendorInfo=Homebrew
Does this issue reproduce with the latest release?
Yes. It worked well on v0.152.x.