30 lines
1.2 KiB
HTML
30 lines
1.2 KiB
HTML
|
|
{% assign sources = '' %}
|
||
|
|
{% if include.img.src or include.img.path %}
|
||
|
|
{% assign srcset = null %}
|
||
|
|
|
||
|
|
{% if include.img.srcset %}
|
||
|
|
{% capture srcset %}{% for hash in include.img.srcset %}{% assign tmp = hash[1] %}{% include_cached smart-url url=tmp %} {{ hash[0] }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
|
||
|
|
{% endif %}
|
||
|
|
|
||
|
|
{% assign src = include.img.src | default:include.img.path %}
|
||
|
|
{% capture sources %}
|
||
|
|
src="{% include_cached smart-url url=src %}"
|
||
|
|
{% if srcset %}srcset="{{ srcset | strip }}"{% endif %}
|
||
|
|
{% if include.sizes %}sizes="{{ include.sizes | replace:' ', '' }}"{% endif %}
|
||
|
|
{% endcapture %}
|
||
|
|
{% else %}
|
||
|
|
{% capture sources %}
|
||
|
|
src="{% include_cached smart-url url=include.img %}"
|
||
|
|
{% endcapture %}
|
||
|
|
{% endif %}
|
||
|
|
|
||
|
|
<img
|
||
|
|
{{ sources }}
|
||
|
|
{% if include.alt %}alt="{{ include.alt }}"{% endif %}
|
||
|
|
{% if include.class %}class="{{ include.class }}"{% endif %}
|
||
|
|
{% if include.property %}property="{{ include.property }}"{% endif %}
|
||
|
|
{% if include.width %}width="{{ include.width }}"{% endif %}
|
||
|
|
{% if include.height %}height="{{ include.height }}"{% endif %}
|
||
|
|
{% if include.width and include.height %}loading="lazy"{% endif %}
|
||
|
|
/>
|