From 8fa9a9b673415ec8ccb904c2e17f8749b72ee914 Mon Sep 17 00:00:00 2001 From: Alexander Avery Date: Wed, 28 May 2025 14:52:28 -0400 Subject: [PATCH] added image partial --- layouts/_default/single.html | 7 ++++++ layouts/partials/image.html | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 layouts/partials/image.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index cf46a6d..984cd33 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -11,6 +11,13 @@

Posted:

+ {{ partial "image.html" + (dict + "image" (.Resources.GetMatch "featured") + "alt" .Params.featured.alt + "sizes" (slice 320 480 600 800) + "classes" "shadow featured") }} + {{ .Content }} {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} {{ end }} diff --git a/layouts/partials/image.html b/layouts/partials/image.html new file mode 100644 index 0000000..b12fbe1 --- /dev/null +++ b/layouts/partials/image.html @@ -0,0 +1,47 @@ +{{- /* +Renders an image with the given class, alt, and sizes. +@contetx {alt} alt text for the image. +@context {image} the image resource. +@context {sizes} each size to include in the srcset. +@context {classes} classes for the image. +*/}} + + +{{ $alt := .alt }} +{{ $image := .image }} +{{ $sizes := .sizes }} +{{ $classes := .classes }} + +{{ $alt }} \ No newline at end of file