From 5bc9c5a73b74578e76314bc0a5acdd3b8ed34fc8 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Thu, 2 Sep 2021 20:54:50 +0530 Subject: [PATCH] Allow emabling/disabling responsiveImages per page #518 --- layouts/partials/cover.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index e7e2df4..6c7d1ae 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -2,6 +2,7 @@ {{- if (and .Params.cover.image (not $.isHidden)) }} {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
+ {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }} {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }} {{- $cover := (.Page.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- if $cover -}}{{/* i.e it is present in page bundle */}} @@ -10,7 +11,7 @@ {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }} {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} - {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }} + {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }}