diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index d8a5136d..593279b6 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -20,7 +20,7 @@
{{- with $img -}} - {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }} {{- else -}} {{ $altText }} {{- end -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 199a3235..726dac87 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -17,7 +17,7 @@
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }} {{ $class := "mb-6 -mt-4 rounded-md" }} - {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }} {{ with $.Params.coverCaption }}
{{ . | markdownify }}
{{ end }} diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index f0bc2f49..752f84a8 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -1,10 +1,10 @@ {{ $img := .img }} {{ $alt := .alt }} {{ $class := .class }} -{{ $lazy := .lazy }} -{{ $webp := .webp }} -{{ $lqip := .lqip }} -{{ $x2 := .x2 }} +{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }} +{{ $webp := .webp | default $.Page.Site.Params.enableImageWebp | default true }} +{{ $lqip := .lqip | default false }} +{{ $x2 := .x2 | default false }} {{ with $img }} {{ if (eq .MediaType.SubType "svg") }} diff --git a/layouts/partials/pictureDefaults.html b/layouts/partials/pictureDefaults.html deleted file mode 100644 index 9ce43084..00000000 --- a/layouts/partials/pictureDefaults.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ $img := .img }} -{{ $alt := .alt }} -{{ $class := .class }} -{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }} -{{ $webp := $.Page.Site.Params.enableImageWebp | default true }} -{{ $lqip := false }} -{{ $x2 := .x2 }} -{{ partial "picture.html" (dict "img" $img "alt" $alt "class" $class "lazy" $lazy "webp" $webp "lqip" $lqip "x2" $x2) }} \ No newline at end of file diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index f0d49dfe..118b7a05 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -18,7 +18,7 @@ {{ with $href }}{{ end }} {{- with $img -}} - {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }} {{- else -}} {{ $altText }} {{- end -}} diff --git a/layouts/shortcodes/screenshot.html b/layouts/shortcodes/screenshot.html index 28025748..e08243ce 100644 --- a/layouts/shortcodes/screenshot.html +++ b/layouts/shortcodes/screenshot.html @@ -12,7 +12,7 @@ {{ $altText = (.Get "caption") | markdownify | plainify }} {{ end }} - {{ partial "pictureDefaults.html" (dict "img" $image "alt" $altText "x2" true) }} + {{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true) }} {{- if .Get "href" }}{{ end -}} {{- if .Get "caption" -}}