Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All values after the first dot in content/layout/etc. base filenames as identifiers (e.g. language, ext) #13515

Open
bep opened this issue Mar 21, 2025 · 2 comments
Assignees
Labels
Milestone

Comments

@bep
Copy link
Member

bep commented Mar 21, 2025

I'm doing some major spring cleaning by re-designing/implementing all template handling in Hugo (with goals of making it more powerful but also much easier to understand). We have lots of integration tests, which in this case is both a curse and a blessing.

One of my now failing tests is basically this, in a site with 1 language (en):

content/doc1.en.md
content/doc1.fr.md
content/doc1.sv.md

By just looking at the above, it is obvious that these 3 are translations of the same document, but since we only have English defined, we get 3 pages (all with language set to en) with the following paths:

/doc1
/doc1.fr
/doc.sv

Which is obviously wrong. In my new setup, the last two will be thrown out as duplicates.

Note that there may be some examples in the wild somehow broken by this (e.g. /dot.net.md vs /dot.foo.md), but I'm not sure I'm prepared to go the extra mile to complicate this further. Those who think this is a considerable problem needs to raise an convincing argument in this issue..

@bep bep added the Bug label Mar 21, 2025
@bep bep self-assigned this Mar 21, 2025
@bep bep added this to the v0.146.0 milestone Mar 21, 2025
@bep bep pinned this issue Mar 21, 2025
@jmooring
Copy link
Member

I know I've seen this somewhere in the wild, but I have no idea how prevalent it is:

hugo new releases/v1.234.5.md

The alternative would be something like...

hugo new releases/v1-234-5.md

...then modify the slug and title.

We're using a content adapter on the docs site that sets the path to news/vN.N.N, but that is easily changed if needed.

@bep
Copy link
Member Author

bep commented Mar 21, 2025

hugo new releases/v1.234.5.md

In the above example, I would have internally classified 234 and 5 as "unrecognized identifiers", so it would be possible to add a warnidf or something about it.

bep added a commit to bep/hugo that referenced this issue Mar 24, 2025
Some notes:

* We now match using the full page Path and walk downwards from the root to find the most specific template.
* Outputformat definitions with different values of isPlainText is not compatible (a bug in the old setup)

Fixes gohugoio#13515
bep added a commit to bep/hugo that referenced this issue Mar 25, 2025
Some notes:

* We now match using the full page Path and walk downwards from the root to find the most specific template.
* Outputformat definitions with different values of isPlainText is not compatible (a bug in the old setup)

Fixes gohugoio#13515
bep added a commit to bep/hugo that referenced this issue Mar 26, 2025
Some notes:

* We now match using the full page Path and walk downwards from the root to find the most specific template.
* Outputformat definitions with different values of isPlainText is not compatible (a bug in the old setup)

Fixes gohugoio#13515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants