tabi/templates/shortcodes/full_width_image.html
welpo ec31c71b38
feat(shortcodes): add lazy loading & make alt optional
- Implement lazy loading in all image shortcodes, enabled by default.

- Make alt attributes optional across all image shortcodes.

- Optimize HTML output by managing whitespace.
2023-08-26 01:48:16 +02:00

6 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>