Possibility of rich taxonomies (as maps)

It would be nice if Hugo recognized taxonomy terms as maps, in addition to strings, in pages’ frontmatter. For example, taking a taxonomy named contributors, I could then use a frontmatter like:

# how it could be
- name: Mary      # term string
  role: author
- name: John      # term string
  role: editor
- Paul            # term string, as today, to not break existing sites

Facing a taxonomy like that, Hugo could read only contributors.name (or another key, like term) to store the page terms. That way, one could specify not only the page terms, but the relation of page to each term. One could then use those “relation” values (like role) in templates, allowing a richer data model.

I think today this is not possible (please correct me if I’m wrong) without doubling those values:

# how it's today

# actual terms
- Mary      # term string
- John      # term string
- Paul      # term string

# relation to terms
- name: Mary
  role: author
- name: John
  role: editor
- name: Paul

Is it possible or even feasible?

You can add metadata to your taxonomy: Taxonomy Templates | Hugo

So in your example,

<!-- content/contributors/mary/_index.md -->
title: Mary 
role: author

<!-- content/contributors/john/_index.md -->
title: John 
role: editor

<!-- content/contributors/Paul/_index.md -->
title: Paul

I’m aware of that possibility. It adds metadata belonging to the global (in entire site) taxonomy term. It works if, for instance, a contributor has always the same role across entire site.

But what I suggested here is different: keeping that same example, a way to specify a contributor’s role specific to a page. As such information is page-specific, it should be in that page’s metadata, not in a global content/contributors/<name>. It would, then, specify the relation between a specific page and a term.

Again, I know I can add such roles using metadata, Question is: doing so, today, I need to duplicate information (as explained in first post here).

Perhaps all of this wouldn’t make much sense in a blog-like website, where usually simple taxonomies as categories, tags or even authors (without any “role”) simply work.

A possible use case is a portfolio, where each page in a section represents a work. In this scenario, different roles for contributors make sense, for example.

Another example: in a music composer’s portfolio (my specific use case, btw), where each page represents a music, there would be a taxonomy like instruments. Following my suggestion, it’d be possible to specify number of performers for each instrument:

# in page's metadata, as other music would have other instrument quantities
# for a music for 3 violins, 2 cellos, 1 clarinet and 1 percussionist
  - name: violin            # Hugo would read .name as term string
    quantity: 3             # and ignore other fields in taxonomy indexing
  - name: violoncello
    quantity: 2
  - name: clarinet
    quantity: 1
  - name: percussion
    quantity: 1

That way, a visitor could find this music via term pages (e.g. /instruments/violin), and site could implement quantity filters (JavaScript, not Hugo role), for example. (That same idea is applicable to contributors example).

(@pointyfar thank you, anyway.)