New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore 0.48 slash handling in taxonomies #5571

Closed
JLKM opened this Issue Dec 28, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@JLKM
Copy link

JLKM commented Dec 28, 2018

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

The latter, I use in a three level geo-tagging (country/region/city) - further reading - example node:
https://udvandrerne.dk/byer/danmark/midtjylland/sabro/

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:
https://udvandrerne.dk/byer/danmark-midtjylland-sabro/

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 in my opinion, slashes in taxonomies are not a hack. They are awesome!

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 can deliver a perfect fit in both cases.

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

https://discourse.gohugo.io/t/multi-level-taxonomy/4888/11,

@bep bep added the Bug label Dec 28, 2018

@bep bep added this to the v0.54 milestone Dec 28, 2018

@bep

This comment has been minimized.

Copy link
Member

bep commented Dec 28, 2018

Note that something like this would work:

#5513

But I guess that would be unpractical for many levels.

@JLKM

This comment has been minimized.

Copy link
Author

JLKM commented Dec 28, 2018

Issue #5513 certainly presents a workaround to keep using slashes in Hugo taxonomies. I may have missed something, but I'm not able to see, how this hack would bring back a narrowing hierarchy with country/region/city.

  1. It looks like, I would have to set up a config-file with 200+ countries x some regions x a lot of cities
  2. I doesn't seem obvious in 5513, how Hugo would offer the routing and the folder-in-folder structure needed.

As lined out in this post the hard point is to narrow the number of posts when jumping from the country-index to the region-index and down to the city-index.

All index-stuff from the three levels resides in separated folders:

  • a country-folder with subfolders
  • a region-folder with subfolders
  • a city-folder with subfolders

It's the node-indexes, that ties those levels together, so the user doesn't experience those jumps but gets a "zoom-like" experience going from country to region and to city.

In order to make this hierarchy work on the outside, node-indexes have to be positioned precisely in the right subfolder. This again requires, that slashes in a taxonomy are NOT converted to dashes - but continue as slashes "with licence to" create the subfolders necessary on the webserver.

Bottomline: A narrowing hierarchy inside a single taxonomy seems to require slashes, that again get translated to directories on the server. I still don't see any alternative.

@bep

This comment has been minimized.

Copy link
Member

bep commented Dec 28, 2018

@JLKM I was just mentioning it; it's not working for 200 countries + regions, I see that.

@bep bep changed the title Optional slash replacement in taxonomies Restore 0.48 slash handling in taxonomies Dec 28, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 29, 2018

bep added a commit to bep/hugo that referenced this issue Dec 30, 2018

bep added a commit to bep/hugo that referenced this issue Dec 30, 2018

bep added a commit to bep/hugo that referenced this issue Dec 30, 2018

bep added a commit to bep/hugo that referenced this issue Dec 30, 2018

bep added a commit to bep/hugo that referenced this issue Dec 30, 2018

bep added a commit that referenced this issue Dec 30, 2018

@bep bep closed this in 40ffb04 Dec 30, 2018

@max-arnold

This comment has been minimized.

Copy link
Contributor

max-arnold commented Feb 3, 2019

This change caused a regression in the previously fixed issue #3577 (PR #5282) - all articles with a / in title are again moved to subfolders.

Does it make sense to create a separate issue for this?

@JLKM

This comment has been minimized.

Copy link
Author

JLKM commented Feb 3, 2019

Just to eliminate any doubt: The recent reversion in 0.54 to subfolders generated by slashes in taxonomies works absolutely perfect. A unique and brilliant feature has been restored. Thanks for the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment