fix: gallery detection on homepage

Workaround HasShortcode detection issue by defaulting to requiring fancybox. Can temporarily be disabled by setting `site.Params.require_fancybox` to `false`
This commit is contained in:
George Cushen 2021-02-19 10:35:51 +00:00
commit dc09534e2b
2 changed files with 4 additions and 2 deletions

View file

@ -86,7 +86,8 @@
{{ end }}
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }}
{{ if .HasShortcode "gallery" }}
{{/* Workaround `.HasShortcode "gallery"` detection issue on `home/` WidgetPage v1 */}}
{{ if .HasShortcode "gallery" | or (and .IsHome (site.Params.require_fancybox | default true)) }}
{{ 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 }}

View file

@ -14,7 +14,8 @@
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.isotope.url $js.isotope.version) $js.isotope.sri | safeHTML }}
{{ end }}
{{ if .HasShortcode "gallery" }}
{{/* Workaround `.HasShortcode "gallery"` detection issue on `home/` WidgetPage v1 */}}
{{ if .HasShortcode "gallery" | or (and .IsHome (site.Params.require_fancybox | default true)) }}
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.fancybox.url $js.fancybox.version) $js.fancybox.sri | safeHTML }}
{{ end }}