How to display responsive images using GRAV srcset method in TWIG?

@brigaill,

Do you want to remove the @3x in the frontmatter of the page, or in Twig?

You didn’t answer where you wanted @3x to be removed, but I will answer it for the Twig variant…

Try the following, assuming the key of the images is always without the @3x:

{% for key, value in page.header.gallerieAvant %}
  <li>
    {{ page.media[key].html( header.title, value.name|split('.')[0], 'image-zoom__preview js-image-zoom__preview')|raw }}
  </li>
{% endfor %}

By the way, the frontmatter for the gallery doesn’t look familiar to me, would you mind sharing how that is created?

Ouch…, I’m afraid my question wasn’t accurate enough, causing you a bit of extra time and energy to answer the question. :innocent: I hoped for something like: “I’m using plugin ‘GalleryX’”

1 Like