field_test1 is a taxonomy field like fields_tags.

{{ content.field_test1 }} prints the title and the value (not in teaser - why not?). I only want the value and want to print it in the header of the node before {{ label }}.

{{ content.field_test1.value }} or {{ node.field_test1.value }} don't work.

{{ node.field_example.value }} seems to work only for "usual" fields, but not for taxonomy fields.

How to do that?

(I've read the book of Chaz Chumley, but found no solution. I've got an answer of 4k4 in another thread, but I didn't understand. Therefore I've clarified my question here.)

1 Answer 1


That's because a taxonomy field has no values. It contains entities, which are the referenced terms. You get the first term with .entity and then you can get the values inside of the term, for example if the term would have a field_test2:

{{ node.field_test1.entity.field_test2.value }}

Or simply the term label (no .value needed for this):

{{ node.field_test1.entity.label }}

If you need translation use the |translation filter of the module Twig Tweak.

  • is there a possibility to do it different on front page ("yes, show it") or in a special view for that entity (no, don't show it)? May 4, 2017 at 16:20
  • Put it in the {% if not page %} condition, it's already there for the node title.
    – 4uk4
    May 4, 2017 at 17:19
  • Yes, I've done it: {% if not page %} <h2{{ title_attributes.addClass('node__title') }}> <a href="{{ url }}" rel="bookmark">{{ node.field_kategorie.entity.label }}: {{ label }}</a> </h2> {% endif %} Now the label 'll printed at front page AND also at page view too. If I don't want it at page view, what should I do? May 4, 2017 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.