summaryrefslogtreecommitdiff
path: root/internal/lightgallery/html_renderer.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lightgallery/html_renderer.go')
-rw-r--r--internal/lightgallery/html_renderer.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go
index 21bd049..8e184e0 100644
--- a/internal/lightgallery/html_renderer.go
+++ b/internal/lightgallery/html_renderer.go
@@ -60,7 +60,8 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [
for _, img := range gallery.Images {
imageUrlSegments := strings.Split(img.URL, ".")
imageUrlWithoutExt := strings.Join(imageUrlSegments[:len(imageUrlSegments)-1], ".")
- imageNameParts := strings.Split(imageUrlWithoutExt, "-")
+ imageUrlParts := strings.Split(imageUrlWithoutExt, "/")
+ imageNameParts := strings.Split(imageUrlParts[len(imageUrlParts)-1], "-")
var captionBuf bytes.Buffer
captionHTML := img.Caption
@@ -126,7 +127,7 @@ document.addEventListener('htmx:afterRequest', (e) => {
if (e.detail.target.id == 'general-page-body') {
createLightGallery%s();
}
-});
+}, {once: true});
</script>`, galleryID, galleryID, strings.Join(dynamicElements, ","), galleryID, galleryID))
}