Ver código fonte

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`
George Cushen 4 anos atrás
pai
commit
dc09534e2b

+ 2 - 1
wowchemy/layouts/partials/site_head.html

@@ -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 }}
 

+ 2 - 1
wowchemy/layouts/partials/site_js.html

@@ -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 }}