Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save frankyonnetti/3cbe5e63829858fe8b1a54702d1a23fc to your computer and use it in GitHub Desktop.

Select an option

Save frankyonnetti/3cbe5e63829858fe8b1a54702d1a23fc to your computer and use it in GitHub Desktop.
Drupal 8 - render node field on page.html.twig #drupal8 #twig #fields

Drupal 8 & Twig

Render field value

For example, the node title

{{ node.title.value }}

Render field entity value

For example, a field of taxonomy term categories

{{ node.field_categories.entity.name.value }}

Render field value of Paragraph (entity)

You can't print a Paragraph entity in Twig, but you can print every fields

{{ node.field_my_field.entity.field_title.value }}

field_my_field = field in the content-type field_title = field of my Paragraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment