How deep into a folder can you go when using page resources?

The answer to your question is here:

Issues with your setup:

  1. The presence of index.md within components/buttons/ indicates to Hugo that this directory is a leaf bundle. Think of a leaf as the end of a branch. A leaf bundle “Does not allow nesting of more bundles under it.” That is why you get a 404 when trying to visit components/buttons/web/.

    You can fix this by renaming components/buttons/index.md to components/buttons/_index.md. This indicates to Hugo that the directory is a branch bundle, which allows nested content.

  2. But now we have another problem. You can access page resources from both leaf and branch bundles, but branch bundles can only access “non-page” resources. A markdown file is a “page” resource. This means you cannot use a markdown file as a resource within a branch bundle. But you can within a leaf bundle. You could do something like this instead:

    components/
    └── buttons
        ├── web
        │   ├── demo-1-1.md
        │   └── index.md
        ├── demo-1-1.txt
        └── _index.md
    

Notice that I have changed the extension of the demo file in the components/buttons from .md to .txt, which makes it a “non-page” resource, accessible from a branch bundle.

This might also be helpful:
https://discourse.gohugo.io/t/content-depth-migrating-from-jekyll/26635/6

4 Likes