Multi-level site creation, with index.html on every level

Hello people and thank you for your help in advance!

What I’d like to create is a multi-depth site, but I am facing an issue that drives me mad – and I don’t know even if it is supported by hugo.

First of all, I turned on
uglyURLs = true
since I prefer to have pagenames ending with .html , as they used to in the old days :slight_smile:

Ideally my site would like to be like:


and so on. Note, categories and subcategories have one html page, and alongside in subcategories are the items (“leaves” if you prefer) with data about these items.

I’ve found that, if I have an page on the leaves, it is as expected.
But if I have an on the category, no subcategory pages are created.
If on the other hand I create an file under category, the subcategory is created but instead of creating an /category1/index.html , a /category1.html file is created.

I can understand the logic behind it and with data-duplication (i.e. data in both and I could solve this issue, but as a programmer I hate duplication.

Thus I decided to ask for help in the gurus here, to tell me if there’s a way to handle this or if I am doing something fundamentally wrong.

Hi, and are Hugo’s way of determining whether your Page Bundle is a leaf or a branch bundle. = leaf bundle = no child pages = no subcategories generated in your case. Any page-type content (subcategory pages in your case) are treated as Page Resources. You can access their .Content, but these will not have a .Permalink.

You can specify the URL to be used manually: URL Management | Hugo

Ok thank you.
So maybe the only way to achieve what I want maybe would be with a symlink to avoid duplication, since (if I got it right) it’s the way hugo understands its context.

Could you explain a bit what you mean by duplication in this case? I’m not sure I understand your context.

OK, and thank you again for your time.

Since I don’t want to change my old site URLs (and don’t want to depend on apache’s tricks to do the same thing), I’d prefer, if possible, the generator to do this for me.

So, as I said with the original question, I need the section url to be an “index.html” file under the folder named as the section, and alongside the “leaf” pages to be named as “itemX.html”, instead of “itemX/index.html”.

So right not I am duplicating and so, that a “/category/index.html” and “/category.html”, alongside “category/itemX.html” will exist (while practically I’ll ignore “category.html”).

I am trying to do something similar with permalinks, to rename either of it, but still fail to do so.
At least, if this could not be done, to have a second look and see what I can do instead!

Instead of duplicating, you could instead specify the urls for the nested sections:

Given the following content structure:

├── cat1
│   ├──
│   ├── subcat1
│   │   ├──
│   │   ├──
│   │   └──
│   └── subcat2
│       ├──
│       ├──
│       └──

If I set the urls in the front matter:

<!-- cat1/  -->
url: /cat1/index.html

<!-- cat1/subcat1/  -->
url: /cat1/subcat1/index.html

<!-- cat1/subcat2/  -->
url: /cat1/subcat2/index.html

With uglyURLS = true , I get the following generated:

├── cat1
│   ├── index.html
│   ├── subcat1
│   │   ├── index.html
│   │   ├── item1.html
│   │   └── item2.html
│   └── subcat2
│       ├── index.html
│       ├── item1.html
│       └── item2.html
└── index.html

This indeed produces a single html file, but this file contains the atom entries of the category, not the html. And of course, an xml file is not created. :frowning: