adds headshot resource support

This commit is contained in:
Drew
2025-04-25 21:33:57 -06:00
parent b89373b478
commit 451e860697
14 changed files with 122 additions and 58 deletions

View File

@ -0,0 +1,19 @@
{{ $width := .width }}
{{ $height := default $width .height }}
{{ $class := .class }}
{{ $resource := .resource }}
{{ $alt := .alt }}
{{ with $resource }}
{{ $image := .Fit (printf "%dx%d webp" (int $width) (int $height)) }}
{{ $fallback := .Fit (printf "%dx%d" (int $width) (int $height)) }}
<picture class="{{ $class }} block">
<source srcset="{{ $image.RelPermalink }}" type="image/webp">
<img
src="{{ $fallback.RelPermalink }}"
alt="{{ $alt }}"
width="{{ $width }}"
height="{{ $height }}"
loading="lazy">
</picture>
{{ end }}