# I’d like some help with Tera language if and elseif statements

**URL:** <https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982>\
**Category:** Support\
**Created:** [October 3, 2026, 8:10am UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982 "2026-10-03T08:10:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffPorter](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jeffporter/32/1250_2.png) [@JeffPorter](https://zola.discourse.group/u/JeffPorter)\
**Post date:** [October 3, 2026, 8:10am UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/1 "2026-10-03T08:10:43Z")

</div>

I’m not good at all with writing out Tera. What I’m trying to do is say:

If term.name = widgets

output this description

So far I have got this:

````auto
  {% if term.name | widgets %}
    <h2>Description</h2>
  {% endif %}
```

````

This doesn’t work, as in the description isn’t output for that particular term.

It would also be useful to know how to use an``elseif`.`Any advice appreciated.

---

<div class="post-metadata">

**Author:** ![charlie137](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/charlie137/32/1140_2.png) [@charlie137](https://zola.discourse.group/u/charlie137)\
**Post date:** [October 3, 2026, 2:39pm UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/2 "2026-10-03T14:39:59Z")

</div>

```auto
{% if price < 10 or always_show %}
   Price is {{ price }}.
{% elif price > 1000 and not rich %}
   That's expensive!
{% else %}
    N/A
{% endif %}

```

> **[If🔗 - Tera](https://keats.github.io/tera/#if)**
>
> If you are coming from Tera v1, see the migration guide. | Tera - A template engine for Rust inspired by Jinja2 and Django templates

---

<div class="post-metadata">

**Author:** ![JeffPorter](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jeffporter/32/1250_2.png) [@JeffPorter](https://zola.discourse.group/u/JeffPorter)\
**Post date:** [October 3, 2026, 3:59pm UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/3 "2026-10-03T15:59:09Z")

</div>

Thanks for this, but I am looking for something to do with the `taxonomy` and `terms`. Probably didn’t explain myself very well because I don’t know what I’m trying to explain. If a term name on a given page is ‘Widgets’ I need it to return a widgets’ description. If the term name happens to be ‘Wantons’ I need it to return a wantons’ description.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![Colas.Nahaboo](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/colas.nahaboo/32/1610_2.png) [@Colas.Nahaboo](https://zola.discourse.group/u/Colas.Nahaboo)\
**Post date:** [October 4, 2026, 7:45am UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/4 "2026-10-04T07:45:33Z")

</div>

Maybe you want:

```auto
{% if page.taxonomies.categories %}
  {% if "Widgets" in page.taxonomies.categories %}
    <p>Description for Widgets goes here...</p>
  {% elif "Wantons" in page.taxonomies.categories %}
    <p>Description for Wantons goes here...</p>
  {% endif %}
{% endif %}

```

If you end up having many terms, writing dozens of `elif` statements in your template can get messy. You can instead store your term descriptions in `config.toml` under `[extra.term_descriptions]`:

```auto
[extra.term_descriptions]
widgets = "This is the description for widgets."
wantons = "This is the description for wantons."

```

Then in your template, retrieve it dynamically without needing any `if / elif` blocks:

```auto
{% if config.extra.term_descriptions[term.slug] %}
  <p>{{ config.extra.term_descriptions[term.slug] }}</p>
{% endif %}

```

---

<div class="post-metadata">

**Author:** ![JeffPorter](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jeffporter/32/1250_2.png) [@JeffPorter](https://zola.discourse.group/u/JeffPorter)\
**Post date:** [October 4, 2026, 9:43am UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/5 "2026-10-04T09:43:27Z")

</div>

Thanks, Colas. The dynamic method worked for me. The first method didn’t, despite me changing `categories` to `tags`.

Being a complete numpty when it comes to this type of thing, I really appreciate the effort it takes for someone in the know trying to explain things.

---

<div class="post-metadata">

**Author:** ![Colas.Nahaboo](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/colas.nahaboo/32/1610_2.png) [@Colas.Nahaboo](https://zola.discourse.group/u/Colas.Nahaboo)\
**Post date:** [October 4, 2026, 8:54pm UTC](https://zola.discourse.group/t/i-d-like-some-help-with-tera-language-if-and-elseif-statements/2982/6 "2026-10-04T20:54:40Z")

</div>

Thanks.

Ah Yes, it was “tags”, and it worked for me… but anyways the dynamic version is nicer 🙂

```auto
% if page.taxonomies.tags %}
  {% if "Widgets" in page.taxonomies.tags %}
    <p>Description for Widgets goes here...</p>
  {% elif "Wantons" in page.taxonomies.tags %}
    <p>Description for Wantons goes here...</p>
  {% endif %}
{% endif %}
    

```

I would advise you to use AI, it is an invaluable tool to learn (or just cope with) new systems. Especially for these “How to?” questions.
