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}}