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

leaf bundle layout lookup order is wrong/different than branch bundle #5714

Closed
dotleon opened this issue Feb 25, 2019 · 6 comments
Closed

leaf bundle layout lookup order is wrong/different than branch bundle #5714

dotleon opened this issue Feb 25, 2019 · 6 comments

Comments

@dotleon
Copy link

dotleon commented Feb 25, 2019

Hugo Static Site Generator v0.54.0-B1A82C61 windows/amd64 BuildDate: 2019-02-01T09:42:02Z

Using Windows 10 latest.

Leaf bundles prioritize the /_default/single.html over /bundlename/bundlename.html

So

/content/branch/_index.md

prioritizes

/layout/branch/branch.html,

but the

/content/leaf/index.md

prioritizes

/layout/_default/single.html

over

/layout/leaf/leaf.html

Even if you set the layout in the content front matter, it uses the single.html

Example: https://github.com/dotleon/leafbundlelayoutissue

In this example, one would expect /leafbundle/ and /leafbundlewithlayout/ to use the /layout/leafbundle/leafbundle, instead they're using /layout/_default/single.html

BUT

/branchbundle/ is using the /layout/branchbundle/branchbundle.html

@bep
Copy link
Member

bep commented Feb 25, 2019

What does the documentation say about this?

@dotleon
Copy link
Author

dotleon commented Feb 25, 2019

Lots of things. https://gohugo.io/templates/lookup-order/

Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific.

I'd expect my case the most specific, since I set the layout in front matter. Also branch bundles seems to work as expected. It's the leaf bundles that act weird.

Let's see the examples that could apply here:

Examples: Layout Lookup for Regular Pages
Single page in "posts" section

  • layouts/posts/single.html.html
  • layouts/posts/single.html
  • layouts/_default/single.html.html
  • layouts/_default/single.html

This means that in my example, the /leafbundle/ should at least use /layout/leafbundle/single.html, but even if I rename it to single.html, it doesn't work as expected, and still uses the default template instead.

@dotleon
Copy link
Author

dotleon commented Feb 25, 2019

I'm getting more and more sure that leaf bundles don't follow the documentation at all.
Even if I set the layout, then it should prefer /layout/exampletype/examplelayout.html over anything in /_default/, but it doesn't do that.

@dotleon dotleon closed this as completed Feb 25, 2019
@dotleon dotleon reopened this Feb 25, 2019
@bep
Copy link
Member

bep commented Feb 25, 2019

See this table, which would apply to "leaf bundles":

https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-regular-pages

@bep
Copy link
Member

bep commented Feb 25, 2019

I suspect this issue is mostly about the lookup rules being a little har do understand. We may improve on that in the future, but I suggest you take further questions here: https://discourse.gohugo.io/

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants