From 59b648791d3fa623c8fe66a49aac20cec6197e7f Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sat, 12 Aug 2023 17:50:02 +0100 Subject: [PATCH] fix: gallery lightbox doesn't always load Lightbox may not load in case of gallery shortcode contained within `text` field of a landing page block (v2 blocks). Fix #2972 --- modules/wowchemy/layouts/partials/site_head.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/wowchemy/layouts/partials/site_head.html b/modules/wowchemy/layouts/partials/site_head.html index 0cefd15d..89964e32 100644 --- a/modules/wowchemy/layouts/partials/site_head.html +++ b/modules/wowchemy/layouts/partials/site_head.html @@ -95,6 +95,14 @@ {{ $has_gallery = true }} {{ end }} {{ end }} + {{ if (eq .Type "landing") }} + {{ range $index, $block := .Params.sections }} + {{ if (gt (len (findRE `\{\{< gallery` $block.content.text 1)) 0) }} + {{ $.Page.Store.Set "has_gallery" true }} + {{ $has_gallery = true }} + {{ end }} + {{ end }} + {{ end }} {{ if $has_gallery | or site.Params.require_fancybox }} {{ printf "" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }} {{ end }}