-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Fix base template lookup order for sections #2995
Comments
Is there any idea why this might be happening? |
Where in the documentation did you find the /layouts/gen (the name of your section, I assume) syntax? |
In https://gohugo.io/templates/content/
And then it stopped for some reason. I can give you access to the repository in the screenshot, if you want to try running this. |
OK, I now see that the documentation is inconsistent about this, see https://gohugo.io/templates/list/ So your syntax is correct for single templates, but not list, which does not make much sense. We will have to fix that. But in the meantime, I would recommend sticking with this documentation re. the base templates: https://gohugo.io/templates/blocks/ Moving your section template to
Should do the trick. |
Thank you for your reply! I'm still a bit confused with all the sections :)
Because the following happened (MacOS, hugo v0.18.1): New structure:
The generated file for a single entry (accessible in browser from http://localhost:1313/gen/social/) still has the outer shell from The generated file for "section list" (accessible in browser from http://localhost:1313/gen/) gets its outer shell from |
I added some tests, and I cannot reproduce what you say in your last post. Take this further on the discussion forum (start a new thread, and please post a reference to a full source repo that demonstrates your issue). |
OK, my test was wrong ... There is a issue here, but I will have to look closer into it. |
I will post a link to the repo where this can be reproduced later today. Thank you for looking into this! |
Note: If you add:
This should now work as expected. Also note that with:
The single pages in /mysection will get the base template from _default. |
Thanks! I'll try this out ASAP |
Ok, tried it out. The error is still there for themes. Full version (based on this project):
The following layout works:
The following doesn't work:
I'll go with |
Extract the logic to a testable function and add support for custom output types. Fixes gohugoio#2995
Awesome! Thanks! |
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. |
What's happening
(also see img below)
This happens on both
Hugo 0.18.1
andHugo 0.19-DEV
. Didn't happen onHugo 0.18-DEV
I have a theme, with default layouts defined as follows:
./themes/freja/layouts/_default/{baseof,list,single}.html
For the
gen
section of the website I've overriden all of them:./themes/freja/layouts/gen/{baseof,list,single}.html
And now the section's baseof template isn't used.
Screenshot of the file tree:
./themes/freja/layouts/_default/baseof.html
is a regular html file:whereas
./themes/freja/layouts/gen/baseof.html
is just a shell:The rest of the templates are quite similar.
The result for
/gen
should look like this: https://dmitriid.com/gen/social/ Now, however, the output is surrounded by HTML from the theme's defaultbaseof.html
The text was updated successfully, but these errors were encountered: