From a1c22b34910825668db5cc2b0790d8a6406cb37c Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 31 Dec 2024 09:39:46 -0800 Subject: [PATCH] Clean up partial calls in figures/image - Include the custom class passed to the template - Factor out multiple computations of $shouldShowTitle into a variable and pass that to called partials --- layouts/shortcodes/figures/image.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/layouts/shortcodes/figures/image.html b/layouts/shortcodes/figures/image.html index 056ca50..50cb620 100644 --- a/layouts/shortcodes/figures/image.html +++ b/layouts/shortcodes/figures/image.html @@ -1,7 +1,5 @@ {{- $imgs := slice -}} -{{- $class := .Get "class" -}} {{- $shouldResize := .Get "shouldResize" | default true -}} -{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} {{- if .Get "name" -}} {{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}} @@ -17,6 +15,8 @@ {{ errorf "No images found for name(s) parameter" }} {{- end -}} +{{- $class := .Get "class" -}} +{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} {{- $size := .Get "size" | default "full" -}} {{ if in (slice "full" "main") $size }} @@ -25,7 +25,8 @@ "page" $.Page "name" (.Get "name") "size" $size - "shouldShowTitle" (.Get "shouldShowTitle" | default true) + "class" $class + "shouldShowTitle" $shouldShowTitle ) }} {{ else if eq $size "small" }} @@ -34,7 +35,8 @@ "page" $.Page "name" (.Get "name") "size" $size - "shouldShowTitle" (.Get "shouldShowTitle" | default true) + "class" $class + "shouldShowTitle" $shouldShowTitle ) }} {{ end }}