Files
aether/layouts/shortcodes/image.html
2021-02-04 00:51:38 -05:00

13 lines
704 B
HTML

<picture>
{{ $image := $.Page.Resources.GetMatch (.Get "src") }}
{{ if gt $image.Width 711 -}}
{{ $resized := $image.Resize "711x Lanczos" }}
{{ $resized_2 := $image.Resize "1422x Lanczos" }}
{{ $resized_3 := $image.Resize "2133x Lanczos" }}
<source srcset="{{ $resized.Permalink }} 1x, {{ $resized_2.Permalink }} 2x, {{ $resized_3.Permalink }} 3x">
<img src="{{ $resized.Permalink }}" {{ if isset .Params "alt" -}} alt="{{ .Get "alt"}}" {{- end }}>
{{ else }}
<source srcset="{{ $image.Permalink }}">
<img src="{{ $image.Permalink }}" {{ if isset .Params "alt" -}} alt="{{ .Get "alt"}}" {{- end }}>
{{- end}}
</picture>