Hey all – apologies if this is a dumb question, I’m a newbie building my first Hugo site and threads like this one and this one have me confused. I’m using version 0.18.1.
Let’s say I have my content organized like this:
├─ Section
| |── Bucket A
│ | ├── article1.md
│ | ├── article2.md
│ | └── article3.md
| |── Bucket B
│ | ├── article4.md
│ | ├── article5.md
│ | └── article6.md
What I want to be able to do is this:
- Have an index.html page under “Section” that lists all six articles from across both buckets.
- Have index.html pages under “Bucket A” and “Bucket B” that list all articles within their bucket.
- Have a menu on all pages that lists Bucket A and Bucket B, with each linked to the index.html listing the contents of that bucket.
This seems like it should be easier to do than it’s turning out to be.
I’ve been able to get the menu (#3) sort of working, by setting an _index.md file in the directory of each Bucket that adds its identifier and weight as an entry in a Hugo menu, and then in the front matter of each article assigning the relevant Bucket’s identifier as the parent for that article. That gives me a listing page for “Section” that includes all sub-articles across all Buckets. But it doesn’t result in index.html pages being created within each Bucket, and the menu items both link to that top-level listing page.
I can make Hugo generate index.html files within each Bucket by renaming those _index.md files to index.md (no leading underscore), and adding url fields to the menu item set in those index.md files for each Bucket. But the resulting index.html files are generated as single content pages, not list pages, so they inherit the wrong template from the theme.
My guess (and I should say up front that it’s an extremely uneducated guess) is that I’m running into a gap between code and documentation resulting from the switch in version 0.18 to the “everything’s a page” content model as described in “Content for home page and other list pages” in the docs. But I’m not sure how to go about organizing things in current versions of Hugo to work as I described at the top, and haven’t been able to piece that together from Googling and searching the forums on my own. So I figured I’d come to the experts.
Again, apologies if this is a dumb question or has already been answered elsewhere. And thanks in advance for any help you can provide!