From 834feb9adc209c3151a229fe5b7d521400153f51 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Fri, 23 Oct 2020 11:35:30 +0530 Subject: [PATCH] cover: responsive cover: generate responsive images only in "production" env - will reduce render time in development env --- 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 7be43ea6..b4487329 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -8,7 +8,8 @@ {{- if $addLink }}{{ end -}} {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }} - {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false)) }} + {{- $prod := (eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production")) }} + {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }}