Hugo: Hugo no longer supports taxonomy separation

Created on 10 Dec 2018  Â·  9Comments  Â·  Source: gohugoio/hugo

I'm not sure if this feature was originally intended with Hugo (it's not documented), but one aspect I used a lot was the ability to separate taxonomies from each other.

My use case:
I have a number of taxonomies/listing pages for different purposes as shown below. I choose this approach for the user experience, I didn't want to have all this content on a single /categories listing page. It would have been confusing to see an ebook, job posting, and a blog post all on the same listing page. To work around this I was able to include slashes in the taxonomies config option which hugo was able to understand.

Examples here of it working:
RetailOps.com/blog/topics/amazon/
or
Retailops.com/resources/categories/ebook/

and my config

[taxonomies]
"resrouces/tag" = "resources/tags"
"resrouces/category" = "resources/categories"
"partners/tag" = "partners/tags"
"partners/category" = "partners/categories"
"news/tag" = "news/tags"
"news/category" = "news/categories"
"careers/tag" = "careers/tags"
"careers/department" = "careers/departments"
"customers/tag" = "customers/tags"
"customers/type" = "customers/types"
"blog/tag" = "blog/tags"
"blog/topic" = "blog/topics"

I get that hugo may not have been meant to work this way, but for a website that offers a wide range of content – blogs, ebooks, PRs, and/or unique listings like integrations – this has been a very useful feature. Sadly this feature seems to have been disabled/broke in hugo 0.48 due to this issue.

The last working release is hugo 0.47.1

Can we discuss reintroducing this capability?

Bug

Most helpful comment

I'm going to force a decision here, as this clearly takes more time than the original issue warrants (it was reported by very few users).

If find @randallmlough 's use of taxonomies very useful and I don't want that blocked by this. While undocumented, the above broke this feature. So I'm rolling back that commit, and we will have to look for another way to handle slashes. A taxonomy name is foremost a path identifier -- the slashes should go into the title. That may be harder to "do simple", but it's the correct way.

All 9 comments

/cc @moorereason

I had a nagging feeling when I merged the mentioned PR.

@onedrawingperday didn't you have a similar issue?

Can you solve this with custom permalinks per taxonomy? I believe that's what @onedrawingperday was doing. See his example config.

@onedrawingperday didn't you have a similar issue?

Similar but not quite the same.

Can you solve this with custom permalinks per taxonomy? I believe that's what @onedrawingperday was doing. See his example config.

I looked at @onedrawingperday config and I'm not sure if this would solve it... Unless I'm thinking about it incorrectly.

How would I go about having multiple "categories" like resources/category, news/category and partners/category? By using the example config it seems like I could only have 1 taxonomy labeled as "category" and it would be permanently tied – by using the permalink method – to only one of the sections above.

Also, doing a quick test it doesnt appear to work correctly.

Example:

[taxonomies]
"blog" = "blog/topics" 
# Tried a number of variations to the above like blog = topics
[permalinks]
"blog" = "/blog/topic/:title/"
# again tried a number of variations

sitemap.xml outputs as
For a page

<url>
    <loc>/blog/topic/3-simple-ways-to-improve-your-inventory-management-system-today/</loc>
    <lastmod>2018-07-17T16:01:21-07:00</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
  </url>

for a category – this doesnt appear to work at all

<url>
    <loc>/blog-topics/amazon/</loc>
    <lastmod>2018-07-27T12:36:24-07:00</lastmod>
    <changefreq>monthly</changefreq>
  </url>

@randallmlough

```
[taxonomies]
"blog" = "blog/topics"

Tried a number of variations to the above like blog = topics

[permalinks]
"blog" = "/blog/topic/:title/"

In linked config I am tricking Hugo into first configuring -for example- a year taxonomy i.e. year = "year" and then setting up the permalink as year = "/drawing/:slug/"

You are configuring a blog taxonomy as "blog/topics" and then trying to set permalinks for blog which is different and bound to not work for "blog/topics".

I'm going to force a decision here, as this clearly takes more time than the original issue warrants (it was reported by very few users).

If find @randallmlough 's use of taxonomies very useful and I don't want that blocked by this. While undocumented, the above broke this feature. So I'm rolling back that commit, and we will have to look for another way to handle slashes. A taxonomy name is foremost a path identifier -- the slashes should go into the title. That may be harder to "do simple", but it's the correct way.

Looking at this, I think this is fixable without rolling back the referenced "slash fix".

thanks you for your work. @bep

but it seems that i've to lock hugo version at 0.2x... lol

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marekr picture marekr  Â·  3Comments

chrissparksnj picture chrissparksnj  Â·  3Comments

nikolas picture nikolas  Â·  3Comments

geddski picture geddski  Â·  3Comments

VoidingWarranties picture VoidingWarranties  Â·  3Comments