I’m setting up a site structure where I like to attach some extra data to some taxonomy terms (in addition to their name), to be able to use this data during rendering of the term under the list or single templates.
An example of such data would be like a “subtitle” or “short-description” / “summary” for the term.
It’s great that we can do that for pages, and it looks like a very useful feature missing from terms.
I think a work-around for the missing feature is to write a macro which, given the taxonomy name and term, returns the needed data. However, this would be something hard to maintain, b/c of the disconnect between the term definition and where the data would be stored.
I use lots of extra.* values on page front matter and site config alike for things like this.
A few excerpts from my site:
config.toml:
[extra.taxonomies."blog/tags"]
[extra.taxonomies."blog/tags".misc]
name = "Miscellaneous"
title = "Anything otherwise uncategorised"
description = "These posts are one‐off tech‐related things that I don’t have a better categorisation for."
[extra.taxonomies."blog/tags".rust]
name = "Rust"
title = "The Rust programming language"
description = "I write about Rust things routinely. Here they all are."
[extra.taxonomies."blog/tags".fun]
name = "Fun"
description = "Most of what I write is intended to be useful, but sometimes I write things just for fun. I make no guarantee that you will enjoy them; it is enough that <em>I</em> do."
{% macro render_tag(name, link=true) %}
{%- set title = config.extra.taxonomies["blog/tags"][name].title | default(value = '') -%}
<
{%- if link -%}
a href={{ get_taxonomy_url(kind="blog/tags", name=name) }}
{%- else -%}
span
{%- endif %} class=tag
{%- if title %} title="{{ title }}"{% endif -%}
>{{ config.extra.taxonomies["blog/tags"][name].name }}</{% if link %}a{% else %}span{% endif %}>
{%- endmacro %}
(Meta: @keats, this site’s highlight.js needs a few languages added: rust, toml, and django, ideally with “tera” as an alias for django. I hope it’s possible to add them in this environment?)