mirror of
https://github.com/pawroman/zola-theme-terminimal
synced 2024-11-25 05:50:17 +00:00
shortcodes: use async and lazy for images.
Zola v0.18 added an option to set all images with `decoding=async` and `load=lazy`, but this only applies to `<img>` tags generated from Markdown `![]()` syntax. This patch adds these attributes by default to `figure` and `image` macros.
This commit is contained in:
parent
03ce85ecba
commit
bef4cc9020
2 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
{% if src %}
|
||||
<figure class="{% if position %}{{ position }}{% else -%} center {%- endif %}" >
|
||||
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if style %} style="{{ style }}"{% endif %} />
|
||||
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if style %} style="{{ style }}"{% endif %} decoding="async" loading="lazy"/>
|
||||
{% if caption %}
|
||||
<figcaption class="{% if caption_position %}{{ caption_position }}{% else -%} center {%- endif %}"{% if caption_style %} style="{{ caption_style | safe }}"{% endif %}>{{ caption | markdown() | safe }}</figcaption>
|
||||
{% endif %}
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
{# ... then prepend the site's base URL to the image's URL. #}
|
||||
{% set src = config.base_url ~ src %}
|
||||
{% endif %}
|
||||
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} />
|
||||
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} decoding="async" loading="lazy"/>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue