mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-25 21:21:22 +03:00
27 lines
961 B
HTML
27 lines
961 B
HTML
{{ $image := .image }}
|
|
{{ $width := .width | default 1000 }}
|
|
{{ $width1x := div $width 2 }}
|
|
{{ $imageWebp := $image.Resize (printf "%dx webp" $width) }}
|
|
{{ $image1x := $image.Resize (printf "%dx" $width1x) }}
|
|
{{ $image1xWebp := $image.Resize (printf "%dx webp" $width1x) }}
|
|
{{ $class := .class | default "h-64 tablet:h-96 lg:h-full w-full object-cover lg:absolute" }}
|
|
{{ $loading := .loading | default "eager" }}
|
|
<picture>
|
|
<source
|
|
srcset="{{ $imageWebp.RelPermalink }}"
|
|
type="image/webp"
|
|
media="(min-width: 1200px)">
|
|
<source
|
|
srcset="{{ $image.RelPermalink }}"
|
|
type="image/jpeg"
|
|
media="(min-width: 1200px)">
|
|
<source srcset="{{ $image1xWebp.RelPermalink }}" type="image/webp">
|
|
<source srcset="{{ $image1x.RelPermalink }}" type="image/jpeg">
|
|
<img
|
|
class="{{ $class }}"
|
|
src="{{ $image1x.RelPermalink }}"
|
|
alt=""
|
|
loading="{{ $loading }}"
|
|
width="{{ $image1x.Width }}"
|
|
height="{{ $image1x.Height }}">
|
|
</picture>
|