My custom index.html isn't showing up. The default shows up instead

I got this weird problem. Locally, Hugo shows the default index.html page, and whenever I may an edit to my custom index.html page (any edit, even adding a space, literally), a refresh is triggered, as if Hugo wakes up, and says “hey, yes, that’s your index.html file!” and then Hugo correctly displays it on localhost

it’s possibly a caching problem? I don’t know

I deployed my Hugo site on netlify and I got the same issue. got no clue how to fix it. Really need assistance

My custom index.html is in layouts/index.html

I have a netlify.toml in my root. It’s configured like so:

[build]
command = "hugo --gc --minify --cleanDestinationDir"
publish = "public"  # Your final built site goes here

[build.environment]
HUGO_VERSION = "0.145.0"  # Match your local Hugo version

# Optional: Cache Hugo modules/themes for faster builds
[[plugins]]
package = "netlify-plugin-hugo-cache-resources"

If you need more info, please comment down.

Post a link to your repository and we can likely see what the issue is. Without the code we can only guess.

1 Like

here

The custom layout in layouts/index.html always load when I test.

hugo server

Moving it does revert the site to the themes index.html and moving it back makes it active again.

You have an error in the inline js since “#contactForm” does not exist const form = document.getElementById('contactForm'); but that is unrelated I believe,

Dunno if you solved something and I did not run that, but I have some findings for your branch fix-deployment maybe you need to synchronize and or simplify your setup.

for the theme you have

  • a .gitmodule configured
  • a git clone in themes/stack (committed)
  • an import as module in modules.toml
  • an empty theme in config.toml (theme = “”)

various hugo versions

  • netlify.toml → hugo 145.0
  • Dockerfile → hugo latest
  • update-theme → hugo 123.8 (daily update?)
  • github build action log: hugo 147.8 !!!

→ your and the themes layout structure is pre 146.1