gagna
1
Hi
I have this content:
content/about/index.it.md
content/about/index.en.md
Which I want to use with this layout:
/theme/my-theme/layouts/about/single.html
Assuming this:
https://gohugo.io/content-management/sections/#content-section-vs-content-type
I suppose about/index.it.md
will use about
as type by default
How can I do it without setting type: about
on the pages Front Matter?
about
is a leaf bundle at the root of the site. It is not a section. Its .Type
defaults to page
.
gagna
3
Thanks for your help
I linked the wrong documentation, this is the part that made me think that the type
of index.md is sets by default to about
: https://gohugo.io/content-management/types/
Also I found an issue on Github, someone someone with similar thought:
https://github.com/gohugoio/hugo/issues/5714
The basic idea is to create the same folder structure as content
inside the layout
folder
Found another topic about this: here
Setting type
in front matter seems the only solution
Because its .Type
is page
, the lookup order is:
- layouts/page/single.html
- layouts/_default/single.html
If you place layout = "about"
in front matter, the lookup order will be:
- layouts/page/about.html
- layouts/_default/about.html
- layouts/page/single.html
- layouts/_default/single.html