How can I print the vocabulary name instead of the referenced term in a node template? Let's say I have a content type article with a field "taxonomy".

The vocabulary is "fruits".

The terms are "apple", "orange", "bananas"

The article belongs to "orange".

I can easily print in my twig template the term of the article :

{{ content.field_taxo_fruit }}


Result is "orange".

But I don't find an easy way to print the vocabulary : "fruits".

On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig
The vocabulary machine name is the bundle ID of the term, which you can get through the node object:

{{ node.field_taxo.entity.bundle }}


To load the label of the vocabulary:

{{ node.field_taxo.entity.vid.entity.label }}


This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.