Generating html files with names other than index.html

Hi.

I have a website with this structure:

content
│   _index.md
│
└───section
        _index.html
        something.html

All the html files have front matter. I was expecting an output like this:

public
│   index.html
│   ...
│
├───section
│       index.html
│       index.xml
│       something.html
│
├───categories
│       ...
│
└───tags
        ...

But instead I got this:

public
│   index.html
│   ...
│
├───section
│   │   index.html
│   │   index.xml
│   │
│   └───something          # Why?
│           index.html
│
├───categories
│       ...
│
└───tags
        ...

It seems that no matter what I do, Hugo always generates folders with index.html files instead of putting the name in the file. This causes problems with relative URLs.

Is there any way to use Hugo to generate the expected output?

Most web servers serve an index.html when rendering pretty URLs, so where you want example.com/section/something.html, most folks want the URL to be example.com/section/something/.

You’ll want to play with uglyurls:

I know, but, for example: fetching a resource at img.png. In /section/something.html, it would fetch /section/img.png while in /section/something/ it would fetch /section/something/img.png.

Thanks for mentioning uglyurls it seems to be exactly what I need.

Now, with uglyurls, there’s another problem:

public
│   index.html
│   section.html           # What?
│
├───section                # Where's index.html?
│       index.xml
│       something.html
│
├───categories
│       ...
│
└───tags
        ...

It seems that Hugo treats folder/index.html and folder.html as the same thing. (They’re not.) Is there any way to get the expected output with Hugo (without manually setting the URLs)?