mirror of
https://github.com/welpo/tabi.git
synced 2026-06-09 21:37:34 +02:00
✨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.
This commit is contained in:
parent
1be3fa886c
commit
ec31c71b38
9 changed files with 41 additions and 30 deletions
|
|
@ -1,4 +1,6 @@
|
|||
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
|
||||
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
|
||||
{%- set lazy_loading = lazy_loading | default(value=true) -%}
|
||||
|
||||
<div class="full-width">
|
||||
<img {% if src %}src="{{ get_url(path=src) }}" {% endif %} {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue