Multi-level taxonomy

#1

It would be nice to have a multi-level taxonomy. For example.

config.yaml

taxonomies:
  category: "categories"
  person: "persons"
    annotator: "annotators"
    author: "authors"
    recipient: "recipients"

And if I have in the front matter authors: John Smith, John Smith will automatically be added to the list of the taxonomy person.

I know that this can be done by adding person: in the front matter, but the hierarchy would be more convenient.

0 Likes

Organize section content under nested taxonomy
#2

Up. Is this function, nobody cares?

0 Likes

#3

I’ve been thinking of this feature, and how I would propose it. I called it, “mapping parameters to taxonomy terms”.

My use case was listing XMPP clients in a directly. XMPP has things called XEPs, and they can be fully supported, partial supported, or no support.

So I’d like to something like:

---
title: "email-killah"
xepsupport:
  - "123"
  - "456"
xeppartial:
  - "678"
xeps:
  - "123"
  - "456"
  - "678"
---

Ideally I could configure it so xepsupport and xeppartial are “mapped” to the xeps taxonomy. There are few other examples where this would be handy for me.

@Mikhail, is that similar enough to what you are talking about?

1 Like

#4

What you are offering is working now, if you manually add xeps: in each article. I suggest that the list of xerp: be automatically formed if the xerp: is designated as the parent in the hierarchy in the config.yaml

0 Likes

#5

Right. That was an example of how it looks now, but I’d like to only use the following frontmatter:

---
title: "email-killah"
xepsupport:
  - "123"
  - "456"
xeppartial:
  - "678"
---

This might be something different than what you are talking about, so I’ll make a new feature discussion for it. :slight_smile:

0 Likes

#6

I have not used wordpress for a long time, but people wrote here that taxanomies there support the hierarchy. I did not invent this myself, this logic of the taxonomy is already used in cms.

0 Likes

#7

I am a WordPress specialist, so I can speak to that. WordPress supports two kinds of taxonomies, and one has a hierarchy, but they are based on terms, not the taxonomies themselves.

Each term can have a single parent term. So in your example, you want John Smith to be a sub-term of authors, itself a term in this scenario.

person (taxonomy) > author (term), > John Smith (term)

Is that what you want?

Hugo supports taxonomies the way WordPress does by default, which is a “flat” taxonomy, meaning all terms have the same relationship with each other and the taxonomy.

person (taxnomy) > John Smith (term)

Yeah… your subject was accurate. A “multi-level taxonomy”, or hierarchal taxonomy. :slight_smile:

How would you handle setting sub-terms in TOML or JSON?

1 Like

#8

For me, the main thing is that the term from a subsidiary taxonomy is automatically included in the parent taxonomy. Whether it will be reflected in the URL for me is not important, but ideally it is desirable to give the user the opportunity to choose: display the hierarchy in the URL or not.

taxonomies:
  category: "categories"
  person: "persons"
    annotator: "persons/annotators" -- hierarchy in the URL as option.
    author: "authors"
    recipient: "recipients"
0 Likes

Optional slash replacement in taxonomies
Taxonomies by Content Type
#9

I am not an expert in formats, but I don’t think TOML and YAML nest values the same way. Instead of nesting taxonomies in front matter, would it be easier to config one taxonomy as a nested inside another taxonomy, from the config? Presuming it is possible, of course! :slight_smile:

0 Likes

#10

Terms with slashes have solved my issue with a three level geo-taxonomy (country/region/city). Please visit example-page and click on one of the regions to see it in action.

This works due to some extra taxonomy/templates.html, which extract the right levels.

Hope this could be of help to you.

0 Likes

#11

That’s pretty cool! But can you please share the source if possible (or a mini example version of this site)?

0 Likes

#12

It took some days - well weeks exactly - to make this work. And today I sometimes wonder, what happened…

Bottom line is, that the country/region/city feature includes a substancial number of template- and sub-template files. And even more of the same in order to translate special scandinavian letters from urls. This forum is not the right place for al this stuff.

But the main idea is straight forward. You need separate taxonomy/tempates for each route/level - ex.:

  1. https://udvandrerne.dk/lande/frankrig/
  2. https://udvandrerne.dk/regioner/frankrig/aquitaine/
  3. https://udvandrerne.dk/byer/frankrig/aquitaine/landiras/

The routes being lande (countries), regioner (regions) and byer (cities).

Next step is to make all links refer to not the present level/route - but the next level/route.

Then it should work.

0 Likes

#13

I have not read the entire thread, but to me the core of this is the definition of the hierarchy.

Given this definition:

taxonomies:
  category: "categories"
  person: "persons"
    annotator: "annotators"
    author: "authors"
    recipient: "recipients"

If you expand on the current Hugo model, you will get an implied hierarchy from the URLs, but not a navigational tree structure. You will get a terms list on each level, but will get the lead nodes only in the .Data.Pages. But that is probably good enough (at least an improvement of what we have).

0 Likes

#14

I understood that using the union function in the template, I can create a common list of terms for the three taxonomies. But the terms URL will lead to different folders. In principle, Hugo allows me to do what I want, but not quite like in cms.

0 Likes

#15

I am behind a few releases, so don’t completely grok “lead node”. Is what you are describing look like this:

authors:
  - Alice
  - Frank
annotators:
  - Bob
recipients:
  - Carol
  - Dan
  - Eve

I think what you are describing is that the following paths are created:

/persons/alice
/persons/bob
/persons/carol
/persons/dan
/persons/eve
/persons/frank

A page won’t be created for /persons/authors/alice, but you can still use implied hierarchy to range over a list of content where Alice was an author. Is that correct?

Also, sorry if this is stale; a cursory issue search didn’t find anything about this. :slight_smile:

0 Likes