From 2c474aa8ae5a5cbca8d9c18b04ddb54ae3c89b39 Mon Sep 17 00:00:00 2001 From: Duncan Mackenzie Date: Tue, 7 May 2024 07:36:49 -0700 Subject: [PATCH] fixing embedded image --- .../layouts/partials/singleImage-embed.html | 20 +++++++++++++++++++ .../layouts/shortcodes/albumImage.html | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 themes/hello-friend-ng/layouts/partials/singleImage-embed.html diff --git a/themes/hello-friend-ng/layouts/partials/singleImage-embed.html b/themes/hello-friend-ng/layouts/partials/singleImage-embed.html new file mode 100644 index 00000000..43e0c1e0 --- /dev/null +++ b/themes/hello-friend-ng/layouts/partials/singleImage-embed.html @@ -0,0 +1,20 @@ +{{ $image := . }} +{{ $full := index ($image.Links) 0 }} +{{ $alt := $image.Caption }} +{{ if not $alt}} +{{ $alt = $image.Title }} +{{ end }} +{{ $srcset := "" }} +{{ range $image.Links }} +{{ $srcset = printf "%s %s %vw," $srcset .Url .Width }} +{{ end }} +{{ $srcset = trim $srcset ","}} + + + {{ $alt }} + + \ No newline at end of file diff --git a/themes/hello-friend-ng/layouts/shortcodes/albumImage.html b/themes/hello-friend-ng/layouts/shortcodes/albumImage.html index 7886ba62..44772fb2 100644 --- a/themes/hello-friend-ng/layouts/shortcodes/albumImage.html +++ b/themes/hello-friend-ng/layouts/shortcodes/albumImage.html @@ -3,7 +3,7 @@ {{ $album := .Site.GetPage $albumName }} {{ $image := index $album.Params.Pictures $imageIndex }} {{ with $image }} -
- {{ partial "singleImage.html" . }} +
+{{ partial "singleImage-embed.html" . }}
{{ end }} \ No newline at end of file