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
    Oct 23, 2017 at 12:17

Your Answer

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

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