Does index.html inherit its layouts from default/baseof.html?

If so how do I prevent this. I want my index.html to have its own layout.

Your home page can have its own layout (the bit between <body> and </body> for example), and inherit everything else from baseof.html. This is accomplished with blocks.

The template for your home page will be layouts/index.html. See https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-home-page.

Try this:

git clone --single-branch -b hugo-forum-topic-27859 https://github.com/jmooring/hugo-testing hugo-forum-topic-27859
cd hugo-forum-topic-27859
hugo server
1 Like

What does your baseof.html and index.html look like?

Firstly, you’d want your base of to only handle the boilerplate code around tags, and let each layout file handle the actually code inside the body tag.

If you don’t want to rely on base of (which still isn’t ideal, because you’ve to then duplicate your head CSS and footer js again) just don’t define a block in your index. Hugo should treat it as its own page.