kobel/layouts/partials/components/image.html

27 lines
No EOL
486 B
HTML

<!--
type: string - default
url: string
alt: string
-->
{{ $avatar := "avatar"}}
<picture>
<source
type="image/avif"
src="{{ .url }}.avif"
/>
<source
type="image/webp"
src="{{ .url }}.webp"
/>
<img
class="{{if eq .type $avatar}} avatar {{end}}"
alt="{{ .alt }}"
src="{{ .url }}"
loading="lazy"
decoding="async"
>
</picture>
{{/* https://www.brycewray.com/posts/2023/05/better-code-image-processing-hugo-render-hook-edition/ */}}