From e18453dac0da6bde3a303c30a77b13633dc7eca7 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 11 Mar 2024 08:28:58 -0700 Subject: [PATCH] Allow the caller of the figures/image shortcode to skip image processing via the shouldResize argument --- layouts/shortcodes/figures/image.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/layouts/shortcodes/figures/image.html b/layouts/shortcodes/figures/image.html index 6d82f30..95f12ef 100644 --- a/layouts/shortcodes/figures/image.html +++ b/layouts/shortcodes/figures/image.html @@ -1,4 +1,7 @@ {{- $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")) -}} @@ -10,21 +13,20 @@ {{ errorf "Missing name or names parameter to figures/image" }} {{- end -}} -{{- $class := .Get "class" -}} - {{- if lt (len $imgs) 0 -}} {{ errorf "No images found for name(s) parameter" }} {{- end -}} -{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} - -
+
- {{ range $img := $imgs -}} - {{- $resizedImg := $img.Fit "1280x1280" -}} + {{ range $img := $imgs }} + {{- $linkedImg := $img -}} + {{- if $shouldResize -}} + {{ $linkedImg = $img.Fit "1280x1280" }} + {{- end -}} {{- $altText := $img.Params.alt | default $img.Title -}} - {{ . }}