Content generated differently between 0.108 vs 0.145

Good day,

I had a content site back in the day where I wanted to have these URLs:

/states/texas/
/states/texas/houston/
/states/texas/houston/aquarium-downtown/

I think in 0.108 there was a bug which I was taking advantage of, where I would create the following files:

/states/texas/index.md                     # the content I wanted to show on /states/texas/
/states/texas/_index.md                    # just an empty file to make it a section
/states/texas/houston/index.md             # the content I wanted to show on /states/texas/houston/
/states/texas/houston/_index.md            # just an empty file to make it a section
/states/texas/houston/aquarium-downtown.md # the location for a page for the aquarium

And with that structure, I would get these files on the sitemap (which I didn’t touch the sitemap template code, just using the one that comes with it).

Recently I updated to v0.145.0 and this no longer works. The same code organization now yields 404s for some routes:

$ curl -I http://localhost:1313/states/texas/
HTTP/1.1 404 Not Found
X-Hugo-Redirect: true
Date: Mon, 28 Apr 2025 01:45:01 GMT
Content-Type: text/html; charset=utf-8

$ curl -I http://localhost:1313/states/texas/houston/
HTTP/1.1 404 Not Found
X-Hugo-Redirect: true
Date: Mon, 28 Apr 2025 01:45:35 GMT
Content-Type: text/html; charset=utf-8

$ curl -I http://localhost:1313/states/texas/houston/aquarium-downtown/
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 9339
Content-Type: text/html; charset=utf-8
Last-Modified: Mon, 28 Apr 2025 01:44:43 GMT
Date: Mon, 28 Apr 2025 01:46:46 GMT

Only the deepest file gets served. I tried a few things, for example, using the following file structure:

/states/texas/index.md
/states/texas/houston/index.md
/states/texas/houston/aquarium-downtown/index.md

And that does seem to work. The following routes get created:

http://localhost:1313/states/texas/
http://localhost:1313/states/texas/houston/
http://localhost:1313/states/texas/houston/aquarium-downtown/

But the sitemap seems to not have them:

$ curl -s http://localhost:1313/sitemap.xml | grep "states/texas"
    <loc>http://localhost:1313/states/texas/</loc>

$ curl -s http://localhost:1313/sitemap.xml | grep "states/texas/houston"
   # no results

$ curl -s http://localhost:1313/sitemap.xml | grep "states/texas/houston/aquarium-downtown"
   # no results

And sites.Pages doesn’t show these either.

How can I fix the folder structure so all these routes show?

Move the content you have in your index.md to _index.md and then delete both index.md.

A index.md creates a leaf bundle, i.e. a page.

A _index.md creates a branch bundle, i.e. a section.

See Page bundles