diff options
author | Karl <kc0bfv@gmail.com> | 2021-11-12 01:37:02 +0300 |
---|---|---|
committer | Karl <kc0bfv@gmail.com> | 2021-11-12 01:37:02 +0300 |
commit | 221e1ebe87cd4408d1d216cc2d8fa4d9c748adb1 (patch) | |
tree | bf1346d0d78ba888f4c0b0b79b5ba0f723e49e66 | |
parent | e7e8e13b10c4634523b98a9912ed36bf22fcaee5 (diff) |
Simplify the logic
-rw-r--r-- | layouts/partials/sect_and_img_content.html | 16 |
1 files 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) }} |