From e3b93e5e0ff6e8d94eaf81a889384fb884eaba94 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 25 Nov 2024 09:52:22 -0800 Subject: [PATCH] Rewrite the figures/image template to use the new figures in the termlite theme --- layouts/shortcodes/figures/image.html | 49 +++++++++++---------------- themes/termlite | 2 +- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/layouts/shortcodes/figures/image.html b/layouts/shortcodes/figures/image.html index 9372b06..056ca50 100644 --- a/layouts/shortcodes/figures/image.html +++ b/layouts/shortcodes/figures/image.html @@ -17,35 +17,24 @@ {{ errorf "No images found for name(s) parameter" }} {{- end -}} -{{ with $item := index $imgs 0 }} -
-
- {{ if eq $item.ResourceType "image" }} - {{- $processedImage := $item -}} - {{- if $shouldResize -}} - {{ $processedImage = $item.Fit "1280x1280" }} - {{- end -}} +{{- $size := .Get "size" | default "full" -}} - {{- $altText := $item.Params.alt | default $item.Title -}} - - {{ . }} - - {{ else if eq $item.ResourceType "video" }} - - {{- end }} -
- {{ if $shouldShowTitle -}} - {{- with $item -}} - {{- if gt (len .Title) 0 -}} -
{{ .Title | markdownify }}
- {{- end -}} - {{- end -}} - {{- end }} -
-{{ else }} - {{ errorf "Found nil in items list for %s" $.Page.Permalink }} +{{ if in (slice "full" "main") $size }} + {{ + partial "page/figures/fullwidth.html" (dict + "page" $.Page + "name" (.Get "name") + "size" $size + "shouldShowTitle" (.Get "shouldShowTitle" | default true) + ) + }} +{{ else if eq $size "small" }} + {{ + partial "page/figures/small.html" (dict + "page" $.Page + "name" (.Get "name") + "size" $size + "shouldShowTitle" (.Get "shouldShowTitle" | default true) + ) + }} {{ end }} diff --git a/themes/termlite b/themes/termlite index b7ae621..502aa40 160000 --- a/themes/termlite +++ b/themes/termlite @@ -1 +1 @@ -Subproject commit b7ae6211ce477835ffbd0da7ea958bb4a4d5c8e7 +Subproject commit 502aa408d9775d73c1bd75b199897ddbd71e3e28