Check if contains term

Hi, I have some trouble with this one. I just wanna check if an entry of a collection has a specific taxonomy term set. For example, we have the collection 'blog' with entry 'i-already-read-the-docs' and a taxonomy "category" which contains the term 'how-to'. This term is assigned to the blog post, so it is saved in the .md file of the blog post. Now, I want to display further content in the template like shown below, if the category is assigned to the mentioned blog entry cont

Here is the .md file:

content: 'Here is the content of the blog post. Our topic today is to check if a taxonomy term is assigned to a blog entry.'

category:
  - how-to

Here is the corresponding template file (yes, content loads because this template is assigned to this collection in routes.yaml)

<p>{{ content }}</p>
{{ if (category | contains:how-to) }}
  <p>Further content is shown when category is 'how-to'</p>
{{ else if (category | contains:cooking) }}
  <p>This is further content for cooking</p>
{{ /if }}

Yes, I already tried multiple modifiers (like is, in_array, contains_strict etc.) in all ways mentioned in the docs and on this forum.

Hope someone could help me out.

>>>>>>> Unanswered <<<<<<<
2 Replies
3 Followers