Nested page bundles with index.md?

Hi - I’m relatively new to Hugo, and have spent the last few weeks building a site locally. Mostly works well when testing it with the development server. Along the way I’ve gone from v0.92.1 to v0.92.2, and now v0.93.0. I’m using the extended version of Hugo on Debian 11 x86_64, and using the .deb file from the release.

I’m having an issue with the actual rendering step, when generating the final output tree. Pages which work fine with the development server aren’t getting HTML files generated in the output - I’m guessing it might be because of the way I’m organizing my content. It’s not due to draft/expired/future content, all of the content is marked non-draft, with recent timestamps, and the -D -E -F

hugo v0.93.0-07469082+extended linux/amd64 BuildDate=2022-02-28T08:30:42Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.17.6"

I’ve reproduced my issue with a minimal set of content files. The config.toml is:

baseURL = 'http://example.org/'
languageCode = 'en-us'
theme = "mainroad"
mainSections = ["thing", "post"]
publishdir = "/home/USER/hugo-debugging/rendered/"

Minimal content to reproduce the problem:

.../content/
├── posts
│   ├── post-a.md
│   ├── subpost-b
│   │   └── subpost.md
│   └── subpost-c
│       └── subpost.md
└── things
    ├── index.md
    ├── subthing-b
    │   └── index.md
    └── subthing-c
        └── index.md

Here the top-level content kinds are “posts” and “things”. posts is organized one way, with all the markdown files having non-index (or _index) filenames. things, on the other hand, has an index.md file in it, plus subdirectories each with their own index.md file.

When I run Hugo to generate/render the site, the posts/ structure appears to render fully, while the subdirectories in things/ get ignored:

.../rendered/
[...]
├── index.html
[...]
├── posts
│   ├── index.html
[...]
│   ├── post-a
│   │   └── index.html
│   ├── subpost-b
│   │   └── subpost
│   │       └── index.html
│   └── subpost-c
│       └── subpost
│           └── index.html
[...]
└── things
    └── index.html

Note there are no output subdirectories or HTML files at all for the things/subthing-* subdirectories, despite there being index.md files for them.

It doesn’t appear to be a theme issue to me (I’m using mainroad).

Is there some particular reason index.md doesn’t work in these nested structures?

One thing that might be relevant: I’m trying to avoid all of Hugo’s automatic list-ification of content - I don’t want links from any page to other posts/content to be added except those that I include manually. i.e. the site I’m creating is particular pages of content with specified relationships, not a bunch of blog or similar posts linked by publishing order, tags, etc.

Thanks,

Charles

mv content/things/index.md content/things/_index.md

See:

2 Likes

Yes… but that turns the page at …/things/ into an automatically generated list of stuff underneath that directory, which is exactly what I’m trying to avoid.

How can I accomplish:

  • the nested page bundles actually get their index.html generated
  • and, only the contents of my things/index.md or things/_index.md are included the the resulting index.html file?

I realize this can probably be accomplished by taking a slash-and-burn approach to the theme’s files, but I’m not anxious to do that – it would make updating the theme impractical.

I thought there must be a way to just set a var in the front matter of the page to say “don’t automatically add an index of stuff to this carefully crafted page”, but I haven’t discovered it yet.

Thanks,

Charles

Look at the second link that I provided in my previous response.

Ah…

cascade:
  _build:
    list: false

in the _index.md file causes the list to be omitted as it then has 0 eligible list items in its sub-bundles.

Thanks – that was exactly what I’d been beating my head against.

Charles

1 Like

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