From 56aed1a86defbcbdfd6d4405c02524ab02017d79 Mon Sep 17 00:00:00 2001
From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com>
Date: Wed, 3 May 2023 13:10:28 -0500
Subject: [PATCH] refactor: Move thumbnail list template to partial template
file
---
layouts/_default/list.html | 20 ++------------------
layouts/partials/list-item-thumbnail.html | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 18 deletions(-)
create mode 100644 layouts/partials/list-item-thumbnail.html
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 3a813fd..fb5e9aa 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -15,24 +15,8 @@
- {{/* Thumbnail images should be stored as 'thumbnail'.* in the page bundle, but
- historically they might have been referenced as 'thumbnail' in the front
- matter, or (even more historically) as 'cardImage'. Use scratch to
- normalize all these different systems.
- */}}
- {{ $bundleGlob := "thumbnail.*" }}
- {{ $frontThumbGlob := print "images/" (.Params.thumbnail) ".*" }}
- {{ $frontCardGlob := print "images/" (.Params.cardImage) ".jpg" }}
- {{ $allThumbnailGlob := print "{" $frontThumbGlob "," $frontCardGlob "," $bundleGlob "}" }}
- {{ with .Resources.GetMatch $allThumbnailGlob }}
- {{ $thumbnail := . }}
- {{ $thumbnailResized := $thumbnail.Resize "600x" }}
-
- {{ end }}
+ {{ partial "list-item-thumbnail" . }}
+
{{/* Prefer full-text links over local ones */}}
{{ $link := default .RelPermalink (index .Params "link") }}
{{ .Title }}
diff --git a/layouts/partials/list-item-thumbnail.html b/layouts/partials/list-item-thumbnail.html
new file mode 100644
index 0000000..e4b99e9
--- /dev/null
+++ b/layouts/partials/list-item-thumbnail.html
@@ -0,0 +1,18 @@
+{{/* Thumbnail images should be stored as 'thumbnail'.* in the page bundle, but
+ historically they might have been referenced as 'thumbnail' in the front
+ matter, or (even more historically) as 'cardImage'. Use scratch to
+ normalize all these different systems.
+*/}}
+{{ $bundleGlob := "thumbnail.*" }}
+{{ $frontThumbGlob := print "images/" (.Params.thumbnail) ".*" }}
+{{ $frontCardGlob := print "images/" (.Params.cardImage) ".jpg" }}
+{{ $allThumbnailGlob := print "{" $frontThumbGlob "," $frontCardGlob "," $bundleGlob "}" }}
+{{ with .Resources.GetMatch $allThumbnailGlob }}
+ {{ $thumbnail := . }}
+ {{ $thumbnailResized := $thumbnail.Resize "600x" }}
+
+{{ end }}