How to pass the loading='lazy' attribute in img_tag?

Is there a way to pass the loading=“lazy” attribute when using the img_tag?

I have the top current, but did try to the bottom and it did not work.

Any input is appreciated, thank you!

{{ swatch_url | file_img_url: '260x' | img_tag }}

 {{ swatch_url | file_img_url: '260x' | img_tag | loading: 'lazy' }}

Hello @khard , lazy loading it’s only possible with the new image_tag filter

{{ product | image_url: width: 200 | image_tag: class: 'custom-class', loading: 'lazy' }}

If you want to keep using the file_img_url you could do

{{ swatch_url | file_img_url: '260x' | img_tag | replace: '>', 'loading="lazy">' }}

Hope that works for you!