gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.39k stars 7.49k forks source link

Term page is empty if slug contains special characters (such as ' or ó) #12086

Closed CamilleScholtz closed 7 months ago

CamilleScholtz commented 8 months ago

Version

0.123, this did not happen in 0.122 and earlier versions.

Reproduction

I have an authors section/taxonomy, the terms have an _index.md with some frontmatter and a description. I have one author with the name "Tólma", the markdown location of this user is content/authors/tolma/_index.md. This makes it so that when iterating over pages in the authors list the tolma page is empty.

If I rename the directory content/authors/tólma/_index.md it works, however then the directory name no longer corresponds to the slug, and I will have weird characters in my directory. Also this was not needed in earlier Hugo versions. Is this new intended behavior or a bug?

removePathAccents in config is set to true.

A screenshots that should illustrate this problem a bit more visually:

image
jmooring commented 8 months ago

The new behavior is intentional, but I'm not sure I understand the problem. Please take this for a spin and let me know what's wrong with it:

git clone --single-branch -b hugo-github-issue-12086 https://github.com/jmooring/hugo-testing hugo-github-issue-12086
cd hugo-github-issue-12086
hugo server
CamilleScholtz commented 8 months ago

This seems to work just fine, also when renaming the directory to tolma... I suspect maybe something goes wrong when calling the .Pages variable in a taxonomy list template, and not when calling .RegularPages in the home template like in your repository? I will test this tonight.

jmooring commented 7 months ago

@CamilleScholtz In the interest of keep our v0.123.x issue list clean, I am closing this for now. We can re-open if necessary, but everything looks right to me.

CamilleScholtz commented 7 months ago

Some more elaboration, I still don't know why this is exactly intended behavior, especially because it did work in previous versions.

Everything in the documentation makes it seem that (template-backed term) paths are slugs. All paths in my content directory (unless explicitly overwritten) correspond to the slug. Yet for a term titled Rainer Wüssle, where the slug is rainer-wussle, the directory should now be named rainer-wüssle.

Another case where a term with the title ‘Het Dorp’ Genieter could previously be in the directory het-dorp-genieter, it now requires the name ‘het-dorp’-genieter. Is this really intended behavior?

jmooring commented 7 months ago

In a previous comment you wrote, "This seems to work just fine." Is that no longer true?

Everything in the documentation makes it seem that (template-backed term) paths are slugs.

Please point me to that portion of the documentation and I will make the necessary corrections or clarifications.

Yet for a term titled Rainer Wüssle, where the slug is rainer-wussle, the directory should now be named rainer-wüssle.

Yes, that is the intended behavior. You have enabled removePathAccents which is why Hugo removed the path accents from the URL. But internally Hugo v0.123.0 and later uses logical paths to identify content. And a term page is content. As noted in the documentation, a logical path is neither a file path or a URL/slug.

CamilleScholtz commented 7 months ago

Please point me to that portion of the documentation and I will make the necessary corrections or clarifications.

I could not find anywhere explicitly written how they are actually defined. There is this section which uses bruce-willis for term Bruce Willis, which seemed to me to be a slug. I now understand however that this is a logical path!

The logical path link cleared things up for me, since I was under the impression these were slugs. Thanks.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.