I have a taxonomy called Fish and 2 terms in it. Bass and Gold. I have a term reference field on a Page node, and its a select list. The editor can select either Bass or Gold. And I want display something depending on what the user selects. I cannot get it to work. This is what I have tried. Below the Bass tid is '1'.
{% if node.field_term_reference.value == '1' %} <p>The value is Bass</p> {% else %} <p>The value is Gold</p> {% endif %} Below I am outputting the string value bass.
{% if node.field_term_reference[0]['#title'] == "bass" %} <p>The value is Bass</p> {% else %} <p>The value is Gold</p> {% endif %} Both of these return "The value is Gold" I tried this also
{% if node.field_term_reference.label == "bass" %} <p>The value is Bass</p> {% else %} <p>The value is Gold</p> {% endif %} What if you want to add multiple terms and use AND OR "bass" and "finch".
{% if node.field_term_reference.entity.label == "bass" and or "finch" %} How would it be written?