alexohneander-zola/templates/shortcodes/full_width_image.html
Óscar 1c3db86b75
feat(image shortcodes): add lazy loading (#116)
Additionally sets the `alt` parameters as optional and cleans HTML output.
2023-08-26 01:57:19 +02:00

7 lines
403 B
HTML

{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set lazy_loading = lazy_loading | default(value=true) -%}
<div class="full-width">
<img src="{{ get_url(path=src) }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if meta.width %} width="{{ meta.width }}"{% endif %}{% if meta.height %} height="{{ meta.height }}"{% endif %}{% if lazy_loading %} loading="lazy"{% endif %}/>
</div>