How to deal with thousands of files (lots of page bundles)

i edit the content of my site with obsidian or VSCode
the problem is that i have thousands of page bundles… and all these pages are “” or “”
its not that wonderful setup to search and manage all the knowledge base if all files are named the same.

i was thinking: and if Hugo could be configured to read files named like its containing folder like it was an index?:

“/my-page/” like it was “/my-page/”
“/my-page/” like it was “/my-page/”

wouldn’t it be fantastic?

1 Like

Yeah that would be great. Except, it IS that great already.


url: /my-page/

Does the trick. You need to know, that doing it that way you will switch to being a single page, so the single layout will catch the content. If you want to change content you can use the layout frontmatter and put a layout with that name into layouts/_default/layoutname.html.

For deeper nested structures look at slug, that will change only the last part of the URL.


thank you David
i use slug a lot, already. i’ll give a try with the url rewriting

If you do this:

└── post
    └── post-1
        ├── b.jpg

and this:

title = "Post 1"
date = 2021-04-04T21:21:34-07:00
draft = false
url = "/post/post-1/"
This is content/post/post-1/

Then as davidsneighbour describes, you will be able to visit the page at http://localhost:1313/post/post-1/.

However, the template(s) used to render the page will not be able to access b.jpg as a page resource using .ResourcesGet or .Resources.GetMatch. Page resources are only available to page bundles, and page bundles are those directories with either or files at their root.

that’s the problem… i have tons of page bundles (posts, projects , tutorials) and i want to keep media without touching the templates…
if Hugo could think that “files named as containing directory” were it would be much easier