When viewing a node I want to display an associated vocab term field inline with the node. The vocab is called "field_related". If I add {{ node.field_related.entity.label }} to node.html.twig and view the node it outputs the term, but if I add the same print tag to my custom twig template field--node--title--topic.html.twig ("topic" is the content type name) it doesn't output anything. What do I need to do to get it so I can print node.field_related.entity.label in field--node--title--topic.html.twig?

I've been trying various combinations of how to write the tag and fiddling with theme_preprocess_field but so far all I've gotten is a headache.

1 Answer 1


In a field template the parent entity of the field is stored in element['#object'], so you can access the taxonomy field of the node like this:

{{ element['#object'].field_related.entity.label }}

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.