I would like an opinion about my shortcodes for the
Code on pages:
{{< img src="/images/image" alt="Example Image" width="100" height="100" >}}
{{< img-lazy src="/images/image" alt="Example Image" width="100" height="100" >}}
Shortcodes:
img.html:
<picture>
<source srcset="{{ .Get "src" }}.webp" type="image/webp">
<source srcset="{{ .Get "src" }}.png" type="image/png">
<img src="{{ .Get "src" }}.png" alt="{{ .Get "alt"}}" width="{{ .Get "width"}}" height="{{ .Get "height"}}">
</picture>
img-lazy.html:
<picture>
<source srcset="{{ .Get "src" }}.webp" type="image/webp">
<source srcset="{{ .Get "src" }}.png" type="image/png">
<img class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" data-src="{{ .Get "src" }}.png" alt="{{ .Get "alt"}}" width="{{ .Get "width"}}" height="{{ .Get "height"}}">
</picture>
It works. But I want an opinion from someone else. Maybe someone can improve it.