Use theme instead of layouts

I am a beginner.
I added a theme to the site and I indicated it in config.toml but once the deploy is published, the homepage is still layouts/index.html

Welcome to the forums. Please follow the advice at Requesting Help.

1 Like

I have read everything https://gohugo.io/templates/lookup-order/ but I have not yet understood what I have to do to give priority to the layout of the theme, instead of the “main” layout of the site

You have referred to the correct documentation.
The result you are getting is also the expected result in Hugo.
The home page indeed gets rendered from layout/index.html which is the first place Hugo looks for the layout of the Home page, as indicated in the documentation.

1 Like

however I didn’t understand what I have to do to apply the theme instead. do I just rename the layout/index.html file?

@Shashank
I renamed the layout/index.html file and now it seems that the theme is applied but it seems that the style is not. I have many doubts about what I have just done!

Do you still have layout files under yoursite/layouts? If so, maybe try deleting these so they are not used instead of the ones from your theme. I can’t tell from the documentation whether the theme or the project layouts have precedence when they have the same name but give this a try if you haven’t already. From this:

it seems that you didn’t.

Project files always takes precedence over theme files. You use them if you want to override specific theme files with your own custom version. This makes it easy to update the theme when needed.

You can also skip having a theme at all and only use a project files.

I have deleted everything that was in the site/layouts folder. also the _default and partials folders
now works!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.