From 3248ac51d13b1ecf221f3c9ba453cb3da30b9bf3 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 19 Aug 2025 10:02:38 -0700 Subject: [PATCH] Take an .images list of resources in figures/fullwidth and figures/small These two templates take a list of resources to operate on. Since these render image figures, that list is called "images". --- layouts/partials/page/figures/fullwidth.html | 8 +++----- layouts/partials/page/figures/small.html | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/layouts/partials/page/figures/fullwidth.html b/layouts/partials/page/figures/fullwidth.html index d10d467..40f3e46 100644 --- a/layouts/partials/page/figures/fullwidth.html +++ b/layouts/partials/page/figures/fullwidth.html @@ -1,10 +1,8 @@ -{{- $resource := .page.Resources.GetMatch .name -}} -{{- if not $resource }} - {{ errorf "No resource named '%s'. %s" .name .page.Permalink }} -{{ end -}} +{# TODO: Accommodate multiple images here #} +{{- $resource := index .images 0 -}} {{- if eq $resource.ResourceType "image" -}} - {{ partial "page/figures/fullwidth-image.html" (merge . (dict "resource" $resource)) }} + {{ partial "page/figures/fullwidth-image.html" (merge . (dict "resource" $resource)) }} {{- else if eq $resource.ResourceType "video" -}} {{ partial "page/figures/fullwidth-video.html" (merge . (dict "resource" $resource)) }} {{- end -}} diff --git a/layouts/partials/page/figures/small.html b/layouts/partials/page/figures/small.html index 6b39a92..29d4c09 100644 --- a/layouts/partials/page/figures/small.html +++ b/layouts/partials/page/figures/small.html @@ -1,8 +1,8 @@ {{- $page := .page -}} - {{- $shouldShowTitle := .shouldShowTitle -}} -{{- $resource := $page.Resources.GetMatch .name -}} +{# TODO: Accommodate multiple images here. #} +{{- $resource := index .images 0 -}} {{- if not $resource }} {{ errorf "No resource named '%s'. %s" .name .page.Permalink }} {{ end -}}