- Guides & Documentation
Knowledgebase
Featured articles, how-to guides and quick tips.
Paragraphs module Drupal 8 - Printing fields in Twig
Printing rendered fields in your custom Paragraphs template using Twig is super easy.
Exactly as you would in a node template, you can print all rendered content using the {{ content }} variable:
{{ content }}
To print the rendered value of a specific field, you would use:
{{ content.field_custom }}
If you need to check whether the field actually has a value, you should use this syntax:
{% if content.field_custom|render %}
{{ content.field_custom }}
{% endif %}
But what if you need to access the raw value, without any additional field markup? That's easy, just use the following syntax:
{{ content.field_custom.0 }}