| 1 |
{{ $image := .image }} |
| 2 |
{{ $width := .width | default 1000 }} |
| 3 |
{{ $width1x := div $width 2 }} |
| 4 |
{{ $imageWebp := $image.Resize (printf "%dx webp" $width) }} |
| 5 |
{{ $image1x := $image.Resize (printf "%dx" $width1x) }} |
| 6 |
{{ $image1xWebp := $image.Resize (printf "%dx webp" $width1x) }} |
| 7 |
{{ $class := .class | default "h-64 tablet:h-96 lg:h-full w-full object-cover lg:absolute" }} |
| 8 |
{{ $loading := .loading | default "eager" }} |
| 9 |
<picture> |
| 10 |
<source |
| 11 |
srcset="{{ $imageWebp.RelPermalink }}" |
| 12 |
type="image/webp" |
| 13 |
media="(min-width: 1200px)"> |
| 14 |
<source |
| 15 |
srcset="{{ $image.RelPermalink }}" |
| 16 |
type="image/jpeg" |
| 17 |
media="(min-width: 1200px)"> |
| 18 |
<source srcset="{{ $image1xWebp.RelPermalink }}" type="image/webp"> |
| 19 |
<source srcset="{{ $image1x.RelPermalink }}" type="image/jpeg"> |
| 20 |
<img |
| 21 |
class="{{ $class }}" |
| 22 |
src="{{ $image1x.RelPermalink }}" |
| 23 |
alt="" |
| 24 |
loading="{{ $loading }}" |
| 25 |
width="{{ $image1x.Width }}" |
| 26 |
height="{{ $image1x.Height }}"> |
| 27 |
</picture> |