Hugo ignores leaf bundle files that were not changed after the last build

  1. Create a new site according to the Quick Start Guide.
  2. Create a new file: content/index.md. This is an index page for your website.
  3. Create a leaf bundle page: content/faq/index.md. Put some text in it.
  4. Run hugo server. Navigate to http://localhost:1313/faq/. You’ll see the FAQ page content.
  5. Stop hugo server. Delete public folder in the root dir of your hugo project.
  6. Run hugo server. Navigate to http://localhost:1313/faq/. I am getting a 404 error. What I expect to get is still the FAQ page. http://localhost:1313/, the index page of the website is rendered ok, does not give me a 404.
  7. Change content/faq/index.md contents, put a different text there. The browser page is reloaded, I see the new contents of the FAQ page as expected.
  8. If I delete the public folder and start the server again, my FAQ page gives me a 404 again until I change its contents.

Same happens if I just execute hugo to build the website without serving. The FAQ page is missing in public folder completely. It is not included in sitemap.xml either.

Why is my page not picked up after the public folder is deleted? What I witness does not seem like the expected behavior to me especially in case of running plain hugo command.

My hugo.yml (not yaml or toml extension, but this should not matter I guess) is the following:

baseUR: https://example.org/
languageCode: en-us
title: My New Hugo Site
theme: ananke

My hugo version is hugo v0.125.1-68c5ad638c2072969e47262926b912e80fd71a77+extended windows/amd64 BuildDate=2024-04-18T08:21:19Z VendorInfo=gohugoio. Running from powershell.

Rename the file to content/_index.md.

Thank you, @jmooring! It helped and it makes sense! The docs section on Page Bundles mentions:

content/
├── about
│   └── index.md
├── posts
│   ├── my-post
│   │   ├── content-1.md
│   │   ├── content-2.md
│   │   ├── image-1.jpg
│   │   ├── image-2.png
│   │   └── index.md
│   └── my-other-post
│       └── index.md
└── another-section
    ├── foo.md
    └── not-a-leaf-bundle
        ├── bar.md
        └── another-leaf-bundle
            └── index.md

content-1, content-2 These are resources of resource type page, accessible via the Resources method on the Page object. Hugo will not render these as individual pages.

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