HUGO

Homepage using single layout

I have a site where the homepage should use the same layout as other single pages. Is there a way to do this? From my experiments, layouts/index.html uses layouts/_default/baseof.html but not layouts._default/single.html as its base and I can’t work how to tell it to do so.

I don’t want to put everything in baseof.html because there will be other layouts that don’t want to use the same layout as the homepage/single pages.

Your articulation is not very clear so it’s hard for me to understand your situation.
Anyway I think studying how the base template works might help you.
This page with a nice video helped me a lot at least:


If your layouts will differ a lot you can for example just have the basic HTML HEAD BODY structure defined in the baseof.html and define everything else in specific layouts.

See index.html uses the baseof.html the same way single.html uses baseof.html (baseof.html defines places for blocks insertions while the blocks are defined in index and single and other specific layouts) - so you probably can’t make index.html use single.html as its base because single.html is no base at all. But you can make a partial/commonpartofyourlayouts.html and call it both from index.html and single.html.

Plus one more thing to study - lookup order for the homepage layouts: