In the node template, I print an image gallery. I need to add the alt text.

<div class="field--name-field_gallery">
  {{ content.field_gallery }}
  {{ content.field_gallery.alt_field }}

There are many images, which are printed, but the alt text is not printed.

How can I print it?

1 Answer 1


Print the image field in the node template like any other field:

{{ content.field_gallery }}

And then use a field twig to loop through multiple field items:


 <div class="row expanded">
  {% for item in items %}
     {{ item.content }}
     {{ item.alt }}
    {% endfor %}
  • I have not tried it yet, but I think it should work. Thank you
    – Evi
    Commented Oct 23, 2017 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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