Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Taxonomies ignoring uglyurl=true #1989
To be specific, the links to posts are in the uglyURL form - i.e. the link does end in _.html and works correctly.
For category and tag items, the folder being pointed at (e.g. http://localhost:1313/categories/general/) contains an index.xml and a page subdirectory, but no HTML file so doesn't render anything, leaving the user staring at a blank page.
It turns out that at individual category and tag pages are being generated correctly, but the links are wrong.
e.g. the generated link to the general category is
Likewise the tags link (e.g. for tag linux)
Using uglyurls=true is important as it keeps the rendered HTML files in their original directories (i.e. in same relative location next to images etc).
If uglyurls=false, then the rendered HTML file is moved into its own directory breaking all the relative links that it contains to images, files to download ....
The files in /content are generated by Emacs Orgmode's "Export to HTML" and look fine when rendered by Hugo, and the orgmode files are in the own directories with related images and other files i really don't want to shift, so it'd be great if the links to categories and tags when uglyurls=false option was fixed.
Then I get the power of orgmode with the benefits of Hugo :-)
Many thanks - Giovanni
I've just written a little Python 3 program to patch the files in /public so the generated tag and category pages work correctly:
I just tested this, and
Not sure what you mean by "making all the links pointed directly to files".
Can you provide a concrete example of a wrong link produced by Hugo?
(with emphasis on Hugo -- because I suspect many links to taxonomy pages are created manually)
Thanks for checking. I've attached a file that has the examples/blog subdirectory from the Github source for Hugo, and I've added some more posts to the /content/post directory, so there are a reasonable number of categories and tags.
What you see in the public directory is the output of "hugo" - I'm using Hugo v0.15 via Homebrew on a Macbook.
If you run 'hugo server' and have a look at the first post - it's in the General category (and so are lots of other pages) but the link is to the general directory which doesn't contain a HTML file so the displayed page is empty.
Another example, from the home page, scroll down to the post starting with VP2E offcentre. It's in the "Radio" category and has the tag "Antennas" (as do several other pages). Neither of the links on the right hand side of the page show the entries for the category or tag respectively.
Hopefully this concrete example helps. The only change to blog example was add the additional posts, and to add uglyurls = true to the config file.
@GiovanniMoretti I looked at your site. The links are created by the template:
And the template is created by you or the theme author. I fail to see how Hugo could have fixed this one.
If noone is able to provide an example where Hugo is "doing the wrong thing", I'm gonna close this.
It's not my template. It's the closest to a "canonical example" we can get, (the blog example from Hugo's source), given that Hugo doesn't supply a known correct sample theme/template.
Following your lead above, I've modified the template in layouts/post/single so it now gives the correct URL (by adding .html to the end of the link):
And both tags and categories now work. Thank you - I now understand what's going on.
I think this points to out an underlying problem, as most if not all of the themes I tried from the Hugo Theme gallery behaved in the same way, so either
My modification of adding .html explicitly to the layout means it won't work for uglyurls=false.
Is my modification to the layout what you were expecting or is there a more elegant way to make the category and tags links in a layout work correctly when uglyurls=true and and when uglyurls=false?
Apologies if this blindingly obvious to you but I'm completely new to both Hugo and the templating language.
Currently no. I'll keep this open. This will be much easier once ...
... is done.
But currently I guess uglyURLs are for people that is in full control of their templates.
added a commit
Sep 30, 2016
Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.
If this is a bug and you can still reproduce this error on the latest
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.