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
This commit is contained in:
George Cushen committed 2023-08-12 17:50:02 +01:00
1 parent bd183b0755
commit 59b648791d
1 file changed
+8
@@ -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 "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" media=\"print\" onload=\"this.media='all'\">" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }}
{{ end }}