From 221e1ebe87cd4408d1d216cc2d8fa4d9c748adb1 Mon Sep 17 00:00:00 2001 From: Karl Date: Thu, 11 Nov 2021 16:37:02 -0600 Subject: Simplify the logic --- layouts/partials/sect_and_img_content.html | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/layouts/partials/sect_and_img_content.html b/layouts/partials/sect_and_img_content.html index 1449d88..73b54d8 100644 --- a/layouts/partials/sect_and_img_content.html +++ b/layouts/partials/sect_and_img_content.html @@ -10,19 +10,9 @@ {{- $filename_as_phototitle := default false ($.Param "filename_as_phototitle") }} {{- $downloadable := default true ($.Param "images_downloadable") }} - {{- /* Calculate thumb_size string from params unless a finished string is provided in the config. */}} - {{- $.Scratch.Set "thumb_size" (default "" ($.Param "thumb_size")) }} - {{ if (eq ($.Scratch.Get "thumb_size") "") }} - {{- $.Scratch.Set "thumb_size" (printf "%dx q%d" $thumb_width $thumb_quality) }} - {{ end }} - {{- $thumb_size := $.Scratch.Get "thumb_size" }} - - {{- /* Same for full_size string */}} - {{- $.Scratch.Set "full_size" (default "" ($.Param "full_size")) }} - {{ if (eq ($.Scratch.Get "full_size") "") }} - {{- $.Scratch.Set "full_size" (printf "%dx q%d" $full_width $full_quality) }} - {{ end }} - {{- $full_size := $.Scratch.Get "full_size" }} + {{- /* Calculate thumb_ and full_size from params, unless one is provided in the config. */}} + {{- $thumb_size := default (printf "%dx q%d" $thumb_width $thumb_quality) ($.Param "thumb_size") }} + {{- $full_size := default (printf "%dx q%d" $full_width $full_quality) ($.Param "full_size") }} {{- /* Build the list of sections and thumbnails */}} {{- $.Scratch.Set "sections" (slice) }} -- cgit v1.2.3