feat: update image shortcodes for disabling lazyload
This commit is contained in:
parent
3e0a9a4054
commit
f1fdec85de
|
@ -1,3 +1,7 @@
|
|||
{{ $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 -}}
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue