I am new to Drupal8. How can i get the content ? I call a view in page.html.twig like:

{{ page.content.views_block__serviceboxen_block_1 }}

and created a template with name:


How can i access to the content from my view in this template ? I have no idea when i use

{% for row in rows %}


{% for item in items %}

thanks a lot.


solution: you can access the fields with 'content'

e.g. content.body or content.your_field_name.value

in a iteration it looks like:

  {% for item in content['#view'].result %}
      {% set topic = item._entity %} {# just for shorter writing #}

       <li>{{ topic.title.value }}</li> {# or topic.yourFieldName.value #}

  {% endfor %}

Hope it'll help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.