gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.38k stars 7.49k forks source link

Subfolder isn't created when there's no _index.md #11900

Closed edwardgalligan closed 9 months ago

edwardgalligan commented 9 months ago

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154+extended darwin/amd64 BuildDate=2024-01-05T12:21:15Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

Issue

This issue was reported by someone else 5 years ago but was closed without a fix due to a "staleness" bot https://github.com/gohugoio/hugo/issues/6583

5 years later is still exhibits in the latest release, so I wanted to re-open to ask if there's a fix planned or if this is intended behaviour.

To be clear, I can get the desired behaviour by creating both an index.md and an empty dummy _index.md but I see this warning:

WARN  Content directory "<snip>/content/contact-us" have both index.* and _index.* files, pick one.

To be clear, the desired site structure here is to have:

<baseUrl>/contact-us/ --> Main contact page for general enquiries
<baseUrl>/contact-us/topic/ --> Separate contact form for specific enquiries

(and similar structure for other sections on the site)

jmooring commented 9 months ago

You cannot have both index.md and _index.md in the same directory. You would be telling Hugo, "Hey, this directory is a leaf bundle, and a branch bundle," and those two are mutually exclusive.

Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting. We prefer to use GitHub for verified bugs and vetted enhancements. Thanks.

edwardgalligan commented 9 months ago

You would be telling Hugo, "Hey, this directory is a leaf bundle, and a branch bundle," and those two are mutually exclusive.

I'm sorry if I've been unclear here; the intent is definitively to have a branch bundle and NOT a leaf bundle. The bug being reported here is that both files are required to make this work (whereas as you've pointed out index.md is intended for leaf bundles only).

Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting. We prefer to

I haven't asked for any questions nor am I troubleshooting any problems: my setup functions fine with both files in place (branch bundle only). It's exhibiting a warning message that's already been documented in 2019 as a bug with Hugo (that ticket was closed by an automated bot, not by any maintainers for any stated reason).

jmooring commented 9 months ago

both files are required to make this work

No, they are not.

Please create a topic on the forum to ask "How do I do xxx", and someone will be happy to help you. Thanks.