From d6d8d8bcf7356a68e325ecc8c181bf3e0ebf9657 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Thu, 14 Sep 2023 14:10:25 +0200 Subject: [PATCH] Add support for fallback images --- packages/ui/atoms/Figure/Figure.twig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/ui/atoms/Figure/Figure.twig b/packages/ui/atoms/Figure/Figure.twig index b6723538..575de34f 100644 --- a/packages/ui/atoms/Figure/Figure.twig +++ b/packages/ui/atoms/Figure/Figure.twig @@ -11,6 +11,8 @@ * @param string $alt * @param string $caption * @param boolean $lazy + * @param boolean $lazy_fallback + * Define if a fallback image should be added for SEO purpose. * @param 'cover'|'contain'|'fill'|'none' $fit * Define how the image will fit. * @param boolean $absolute @@ -114,6 +116,14 @@
+ {% if lazy and lazy_fallback %} + {% set img_noscript_attributes = img_attributes|without(['data_src', 'data_ref'])|merge({ + src: img_attributes.data_src, + }) %} + + {% endif %}
{% if caption is defined %} {% block caption %}