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

Bug with mixed case section/type to mixed case layout folders #12398

Open
leahoswald opened this issue Apr 19, 2024 · 6 comments
Open

Bug with mixed case section/type to mixed case layout folders #12398

leahoswald opened this issue Apr 19, 2024 · 6 comments
Labels
Milestone

Comments

@leahoswald
Copy link

leahoswald commented Apr 19, 2024

What version of Hugo are you using (hugo version)?

hugo v0.125.1+extended linux/amd64 BuildDate=unknown

from arch linux

Problem

This issue started occurring with hugo v0.123.0. So it worked before. Nothing else changed in the working tree.
For a part of my site, I use a different layout configured under /layouts, but this is ignored starting with 0.123.
I've searched for two hours now, but I can't find any problem with my setup. Everything is like described in the docs (https://gohugo.io/templates/views/). And after doing a downgrade to v0.122.0 it is immediately working again.

The folder tree looks similar to this:

/content/artProject/_index.md
/content/artProject/oneArtProject.md
/content/artProject/anotherArtProject.md

Then there is:
/layouts/artProject/list.html

And according to the docs, this should be used, but instead it is always falling back to:
/themes/themeName/layouts/_default/lists.html

It sounds a little bit similar to #12146 and #12193, but not the same, and I normally would assume that such a big problem would have been observed by others after the time since the 0.123.0 release.

Oh and if I call hugo with --printUnusedTemplates it also tells me that it is not using the stuff under /layouts

WARN Template artProject/list.html is unused, source file ~/mysite/layouts/artProject/list.html

@leahoswald leahoswald changed the title Everything in /layouts is ignored after 0.123.0 Everything in /layouts is ignored after 0.123.0 if not lowercase Apr 19, 2024
@jmooring
Copy link
Member

It would be helpful if you could share your project with us. I am unable to recreate the problem based on the description above.

@leahoswald
Copy link
Author

leahoswald commented Apr 19, 2024

And now, just to be sure, I changed the folder name from "artProject" to only "art" and it magically works. And I can reproduce it! If the folder name is only lowercase it works, if it contains an upper case it is ignored. Is there any naming scheme I couldn't find in the docs?

EDIT: Updated the original issue to reflect this issue.

@jmooring
Copy link
Member

With this content structure:

content/
└── TestDir/
    └── p1.md
Value returned by v0.122.0 Value returned by v0.123.0
{{ .Section }} TestDir testdir
{{ .Type }} TestDir testdir

Which means you can't do this anymore:

layouts/
└── TestDir/
    └── single.html

I'm guessing that both Type and Section are now derived from the logical path (described here) instead of the physical path.

I'm not sure if this is one of the intentional breaking changes in v0.123.0. Regardless, change your layouts structure to:

layouts/
└── testdir/
    └── single.html

@bep bep added this to the v0.125.2 milestone Apr 20, 2024
@bep bep changed the title Everything in /layouts is ignored after 0.123.0 if not lowercase Bug with mixed case section/type to mixed case layout folders Apr 20, 2024
@leahoswald
Copy link
Author

Sounds plausible that it is caused by the function because copying the folder from layouts to the templates layouts folder doesn't help. So it seems to be a global problem. If it is intended and only lowercase is allowed now we should add some documentation for it.

Oh and it doesn't help to just rename the layout folder to a lowercase version, we need to rename the content structure too.

@jmooring
Copy link
Member

it doesn't help to just rename the layout folder to a lowercase version

Yes, it does, try it.

git clone --single-branch -b hugo-github-issue-12398 https://github.com/jmooring/hugo-testing hugo-github-issue-12398
cd hugo-github-issue-12398
hugo server

Then visit http://localhost:1313/testdir/p1/

@leahoswald
Copy link
Author

leahoswald commented Apr 20, 2024

Ah your right, this was a wrong observation either due to caching or changing path names. (It was late yesterday)

@bep bep modified the milestones: v0.125.2, v0.125.3, v0.125.4 Apr 22, 2024
@bep bep modified the milestones: v0.125.4, v0.125.6, v0.125.7 May 1, 2024
@bep bep modified the milestones: v0.125.7, v0.127.0 May 15, 2024
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

3 participants