2020-04-15 15:48:16 +02:00
|
|
|
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) -}}
|
|
|
|
{{ $lqip := $image.Resize $.Site.Params.lqipWidth -}}
|
|
|
|
|
|
|
|
{{ $imgSrc := "" -}}
|
|
|
|
{{ $imgSrcSet := slice -}}
|
|
|
|
|
|
|
|
{{ $widths := $.Site.Params.landscapePhotoWidths -}}
|
|
|
|
{{ if gt $image.Height $image.Width -}}
|
|
|
|
{{ $widths = $.Site.Params.portraitPhotoWidths -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ range $widths -}}
|
2021-04-19 19:19:03 +02:00
|
|
|
{{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}}
|
|
|
|
{{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}}
|
|
|
|
{{ end -}}
|
|
|
|
{{ $imgSrcSet = (delimit $imgSrcSet ",") -}}
|
|
|
|
|
|
|
|
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
|
2021-04-02 19:45:05 +02:00
|
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="{{ $lqip.RelPermalink }}" data-srcset="{{ $imgSrcSet }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
|
|
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}></noscript>
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ with .Get "caption" }}<figcaption class="figure-caption">{{ . | safeHTML }}</figcaption>{{ end }}
|
|
|
|
</figure>
|