mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
✨feat(image shortcodes): add lazy loading (#116)
Additionally sets the `alt` parameters as optional and cleans HTML output.
This commit is contained in:
parent
1be3fa886c
commit
1c3db86b75
9 changed files with 41 additions and 30 deletions
|
@ -1,8 +1,10 @@
|
|||
{% 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) -%}
|
||||
|
||||
{% if full_width | default(value=false) %}
|
||||
<div class="full-width">
|
||||
{% endif %}
|
||||
<img class="dimmable-image" src="{{ get_url(path=src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
||||
<img class="dimmable-image" src="{{ get_url(path=src) }}"{% if lazy_loading %} loading="lazy"{% endif %}{% if alt %} alt="{{ alt }}"{% endif %}{% if meta.width %} width="{{ meta.width }}"{% endif %}{% if meta.height %} height="{{ meta.height }}" {% endif %}/>
|
||||
{% if full_width | default(value=false) %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue