From d33d6b0ff6e059112c35f0f2271a02c635386743 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 16 Jun 2019 19:10:49 +0100 Subject: [PATCH] feat(shortcode): fix Gallery captions + support Markdown in captions Fixes image captions when the Gallery shortcode is used on Widget Pages. The issue was caused by a path mismatch in the code. Adds support for using Markdown and emojis in image gallery captions. Close #1136 - the bug report. --- layouts/shortcodes/gallery.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index b87dbe6d..04d9942d 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -21,14 +21,14 @@ {{ range $images }} {{ $image := .Resize "x190" }} {{/* Check if the user set a caption for this image */}} - {{ $filename := .Name }} + {{ $filename := path.Base .Name }} {{ $caption := "" }} {{ if $.Page.Params.gallery_item }} - {{ range (where $.Page.Params.gallery_item "album" $album) }} - {{if eq (printf "%s/%s" $album .image) $filename}}{{ with .caption }}{{ $caption = . }}{{end}}{{end}} + {{ range (where (where $.Page.Params.gallery_item "album" $album) "image" $filename) }} + {{ $caption = .caption }} + {{ end }} {{ end }} - {{ end }} - + {{end}} @@ -45,7 +45,7 @@ {{ $.Scratch.Set "src" (printf "img/%s" .image | relURL) }} {{ end }} {{ end }} - + {{end}}