The public folder/ does not update

Hello,

While developing a Hugo website WITHOUT a theme, I’m encountering various issues that I can’t resolve. Generally, the public folder isn’t updating properly.

I’ve uploaded the test site code to GitHub

blog1

GitHub link

  1. When I edit the layouts/blogs/single.html or layouts/blogs/list.html files, the changes aren’t always reflected in the rendering of the pages in the public folder.

  2. public/ contains elements that had previously been deleted in content/ or layouts/

blog1-PublicDelete

GitHub link

  • The blog1 folder was copied and named blog1-PublicDelete.

  • In an attempt to refresh the public/ folder, it was deleted, and then the site was rebuilt (command: hugo).

  • Most HTML or XML files in the public/ folder no longer appear !

  • And as a result, 127.0.0.1:1313/blogs returns: Page Not Found.

The codes were tested on two different devices: Linux and Mac.

Hugo versions: v0.145.0 on both devices.

Linux environment :


hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=snap:0.145.0

GOOS="linux"

GOARCH="amd64"

GOVERSION="go1.24.0"

github.com/sass/libsass="3.6.6"

github.com/webmproject/libwebp="v1.3.2"

github.com/sass/dart-sass/protocol="3.1.0"

github.com/sass/dart-sass/compiler="1.85.1"

github.com/sass/dart-sass/implementation="1.85.1"

Mac environment


hugo v0.145.0+extended+withdeploy darwin/arm64 BuildDate=2025-02-26T15:41:25Z VendorInfo=brew

GOOS="darwin"

GOARCH="arm64"

GOVERSION="go1.24.0"

github.com/sass/libsass="3.6.6"

github.com/webmproject/libwebp="v1.3.2"

My questions:

  1. Why isn’t the site refreshing, given that I’ve always had problems with various sites created with Hugo, with instant refreshes, even when clearing Hugo’s caches (hugo serve –ignoreCache) and those of browsers?

  2. Why is it impossible to properly recover it by rebuilding the site after deleting public/?

  3. What are my mistakes?

  4. What are the solutions?

Thank you in advance for any help you can provide.

Sincerely.

mv content/index.md content/_index.md

Test again after making this change, and post again with any remaining issues.

Thank you for your reply.
It works!
Except for a problem displaying images, but I’ll fix that later.
Do you have an explanation for why I need to have an _index.md at the root and not an index.md?

Maybe it’s just a bundle and leaf thing.
I thought the website’s homepage was leaf-style…
Thanks again.

That’s right:

  • A directory with an index.md file is a leaf bundle and has no descendants.
  • A directory with an _index.md file is a branch bundle and has zero or more descendants.

Related: https://github.com/gohugoio/hugo/issues/13538

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