Commit f1fdec85 authored by Henk Verlinde's avatar Henk Verlinde
Browse files

feat: update image shortcodes for disabling lazyload

parent 3e0a9a40
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) -}}
{{ $lqip := $image.Resize $.Site.Params.lqipWidth -}}
{{ if eq .Site.Params.options.lazySizes true -}}
  <img class="img-simple img-fluid lazyload blur-up{{ with .Get "class" }} {{.}}{{ end }}" src="{{ $lqip.RelPermalink }}" data-src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
{{ else -}}
  <img class="img-simple img-fluid{{ with .Get "class" }} {{.}}{{ end }}" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
{{ end -}}
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -17,7 +17,11 @@
{{ $imgSrcSet = (delimit $imgSrcSet ",") -}}

<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
  {{ if eq .Site.Params.options.lazySizes true -}}
    <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 }}>
  {{ else -}}
    <img class="img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
  {{ 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>
  {{ with .Get "caption" }}<figcaption class="figure-caption">{{ . | safeHTML }}</figcaption>{{ end }}
</figure>