diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html
index 97be09e..13d33d9 100644
--- a/layouts/shortcodes/gallery.html
+++ b/layouts/shortcodes/gallery.html
@@ -16,7 +16,7 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
{{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}
{{- if and $isimg (not $isthumb) }}
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}
- {{- $linkURL := print $baseURL ($.Get "dir") "/" .Name | absURL }}
+ {{- $linkURL := print $baseURL "/" ($.Get "dir") "/" .Name | absURL }}
{{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}
{{- $thumbexists := where $files "Name" $thumb }}
{{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}