Skip to content
Twig Field Finder
Theme

Reference — label (term name / node title)

Fill in your field name

Italic values are placeholders: replace them with your own machine names, or let the builder do it.

Reads the entity directly, before field formatters run.

  1. Snippet 1
    {{ node.field_name.entity.label() }}
  2. Snippet 2
    {{ node.field_name.entity.name.value }}
  3. Snippet 3
    {{ node.field_name.entity.title.value }}

Reads the content render array, after field formatters run.

  1. Twig
    {{ content.field_name[0]['#title'] }}

Uses a contrib module’s Twig filter or function.

  1. {{ content.field_name|field_target_entity.label }}
  2. {{ content.field_name|field_target_entity.title.value }}

Gotcha

label() works for any target type; name is for terms, title for nodes.

Contrib modules used

See helper modules for what each one provides.