Optional slash replacement in taxonomies


#1

To me, taxonomies are the main reason, why Hugo stands out from other static site generators. And the ability to handle multi-level taxonomies just widens the gap.

The latter, I use in a three level geo-tagging (country/region/city) - further reading - example node:

Unfortunately, this feature is no longer available. From Hugo 0.48 all slashes in taxonomies seem to be replaced by dashes.

At least that’s what happens in the example node, which no longer gets updated at the old url with slashes. Now the example node above is rendered at (with dashes - not slashes):

Hence, no more browsing down the hierarchy from posts about a country to posts about a region in the same country and further to a selected city in that region.

In this post multi-level taxonomies with slashes are considered a “hack”. Hence Hugo 0.48 fixes this.

But I would argue, there is a use case for both:

  • taxonomies with slashes preserved
  • taxonomies with slashes replaced

A suggestion would be to add a setting - say preserveSlashesInTaxonomies: true/false or replaceSlashesInTaxonomies: true/false, so that Hugo becomes able to deliver a perfect fit in both cases.

Otherwise I’ll have to revert to Hugo 0.47 and use this version permanently.


#2

Create an issue on GH and I will fix this. We will not add an option for this, but the 0.48 “fix” was a bad idea, as shown several times.


#3

Thank you for paying attention to this. I have followed your advice and pretty much copied this post to GitHub. Looking forward to seeing the outcome - and following this awesome project in the future.