Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Hugo with uglyURLs = true generates /public/section.html instead of /public/section/index.html #4428
Discourse thread: https://discourse.gohugo.io/t/section-index-md-page-isnt-being-created/10627
Steps to reproduce:
There is a Hugo documentation page discussing how uglyURLs works: https://gohugo.io/content-management/urls/#ugly-urls
Therefore this is either a bug in Hugo itself, or a mistake in the documentation. I hope it's the former, because this behavior seems totally bizarre and insane to me.
Thanks. So it was a problem with the documentation then.
Is there any way to make Hugo generate the output that I expect though? I don't think I want anything unusual. In my opinion, most people would expect
Personally, I would rather Hugo be changed to generate this the way one would naturally expect (i.e. I'm making a feature request).
I will reopen this as I agree this looks a little funky.
I suppose this is off-topic, but I do wonder why do you seem to have this impatient, dismissive, almost hostile attitude towards people that criticism of Hugo. I ask this not just because of your attitude in this thread (closing the issue with no comment, and then simply redirecting me to Discourse with no feedback on my comments at the time), but also because I've seen a similar attitude from you while searching all over the internet trying to figure out how Hugo works due to the lack of clear documentation.
For example, in issue #4367 you just dismissed them, closed the bug report, and told them to go to Discourse. The person replied confirming their opinion that it was a bug in Hugo, with more details and a repro scenario included, but there's been no response for weeks and the issue is still closed. It honestly puts me off Hugo and makes it seem as though you refuse to engage in any feedback or discussion, but maybe I'm just overreacting and have only seen a few bad examples.
You said it yourself there that "We prefer to use GitHub issues only for bugs and enhancements". I'm making a feature request (enhancement). I literally said that in my previous message. And I already have a thread on Discourse - it's literally in the first line in the OP.
As for the "totally bizarre and insane" line, perhaps it's not very nice, but I don't think that makes it untrue. I apologise if any feelings were hurt. Of course you don't want to be made to feel like your work is unappreciated - but similarly people who take the time to give feedback don't want to feel like they're just being dismissed. I didn't see any code of conduct included for this repository, and other open source projects that I've been involved in have been accepting of such language, as what matters at the end of the day is listening to feedback (even if harsh) and improving the software.
From the perspective of somebody who previously produced websites manually without a static site generator such as Hugo, this behavior seems completely unexpected. Ordinarily, a website will be made up of regular files (e.g.
Perhaps it's because I don't quite understand Hugo's supposed "special handling" of
The way I see "uglyURLs" personally is that it should be "normalURLs". I don't expect anything to be ugly, I expect them to just be normal. I don't want Hugo to mess with my filenames or URLs. I just want file.md to translate to file.html. Personally, I think the default "pretty URLs" are actually quite ugly, littering the directory structure with hundreds of folders and creating index.html files everywhere. I think that most people would prefer to do URL rewriting on the web server with Apache .htaccess rules or Nginx configuration files. Maybe I'm just in a different world though.
My current workaround to this is to rename
Edit: I'm already running into issues with the above hacky workaround. While Hugo generates the section/index.html files that I want when using this hack, it still generates the original junk files, and furthermore the generated sitemap.xml file links to the junk files and makes no mention of the section/index.html files. This means I also have to run a custom post-build task to delete the junk files, and do a series of find+replace searches in sitemap.xml. Interestingly, the section/index.xml files do have the right links though.
Perhaps a new setting could generate the output many of us are expecting:
...while not breaking existing sites which do depend on the current output:
Tongue-in-cheek, may I suggest a config property inspired by this conversation:
Seriously, though, the way the "Web works" since time immemorial has always been this sort of directory structure:
That's what web servers expect. That's what I expect. That's what works when serving a site from a filesystem without a web server. There's a reason it's called index.html!
Quite frankly, Hugo's current "ugly URL" behavior combined with the way it's named (undoubtedly meant in good humor) actually makes Hugo appear to consider this feature to be a "second class citizen" - that's unfriendly! Surely this is not what was intended.
Hugo is a wonderful application and I only wish to see it get better.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
Hi, I stumbled upon this issue as I'm trying to upgrade from 0.21 (old, I know) to the most recent version (0.54 as of now) and it completely breaks my website.
Specifically, with 0.21 I used uglyURLs with the following architecture:
and it would render like so
Unfortunately with 0.54, having the
I did a manual 'binary search' in the releases, this bug/change has been introduced in 0.32. 0.31.1 behaves as I expect, 0.32 breaks my website.
Does this put an end to this issue?