# Can we add extra data to TaxonomyTerm?

**URL:** https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770
**Category:** Feature requests
**Created:** [February 3, 2021, 10:12am UTC](https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770 "2021-02-03T10:12:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![behnam](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/behnam/32/392_2.png) [@behnam](https://zola.discourse.group/u/behnam)
#### Post date: [February 3, 2021, 10:12am UTC](https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770/1 "2021-02-03T10:12:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![southerntofu](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/southerntofu/32/189_2.png) [@southerntofu](https://zola.discourse.group/u/southerntofu)
#### Post date: [February 3, 2021, 1:44pm UTC](https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770/2 "2021-02-03T13:44:39Z")

</div>

Hi, i agree this is a useful feature, especially when it comes to translations of taxonomy stuff. [Here](https://tildegit.org/southerntofu/staticadventures/src/branch/master/templates/skills/single.html) is how i do it on my blog:

- have orphan pages in some folder in content, to describe my taxonomy terms
- get those pages in the templates, and use the page attributes to provide more “taxonomy” context

I think that would be a workaround for your usecase, do you agree?

---

<div class="post-metadata">

### Author: ![chris-morgan](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/chris-morgan/32/16_2.png) [@chris-morgan](https://zola.discourse.group/u/chris-morgan)
#### Post date: [February 6, 2021, 6:30am UTC](https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770/3 "2021-02-06T06:30:36Z")

</div>

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:**

```auto
[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."

```

**templates/blog/tags/single.html** (simplified):

```auto
<title>Blog posts tagged “{{ config.extra.taxonomies["blog/tags"][term.slug].name }}”</title>
<p>{{ config.extra.taxonomies["blog/tags"][term.slug].description }}

```

And one of my many macross:

```nohighlight
{% 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?)

---

<div class="post-metadata">

### Author: ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)
#### Post date: [February 6, 2021, 3:36pm UTC](https://zola.discourse.group/t/can-we-add-extra-data-to-taxonomyterm/770/4 "2021-02-06T15:36:53Z")

</div>

> [@chris-morgan](#):
>
> (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?)

I’ve just added Rust, TypeScript, Django and Twig (closest to Jinja2/Tera). Toml doesn’t seem available 😕
