diff --git a/wowchemy/layouts/partials/site_head.html b/wowchemy/layouts/partials/site_head.html index 2c29e216..c0728687 100644 --- a/wowchemy/layouts/partials/site_head.html +++ b/wowchemy/layouts/partials/site_head.html @@ -12,6 +12,26 @@ {{- end -}} + {{/* Parse theme and font */}} + {{ partial "functions/parse_theme" . }} + + {{/* Pre-connect to Google Fonts if the site's Font Theme uses them. */}} + {{ with ($scr.Get "google_fonts") }} + + {{ end }} + + {{/* Load Google Fonts if the site's Font Theme uses them. */}} + {{/* Note: we cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}} + {{ with ($scr.Get "google_fonts") }} + {{ if hasPrefix . "family=" }} + {{/* If `google_fonts` starts with "family=", use API v2 (https://developers.google.com/fonts/docs/css2) */}} + + + {{ else }} + {{ errorf "There is a new version of Google Fonts. Learn how to upgrade your font pack at https://wowchemy.com/docs/customization/#custom-font" }} + {{ end }} + {{ end }} + {{ if site.Params.marketing.google_optimize | and hugo.IsProduction }} {{- end -}} @@ -61,13 +81,6 @@ {{ end }} - {{ partial "functions/parse_theme" . }} - - {{/* Pre-connect to Google Fonts if the site's Font Theme uses them. */}} - {{ with ($scr.Get "google_fonts") }} - - {{ end }} - {{ $css := site.Data.assets.css }} {{ $js := site.Data.assets.js }} {{ if ne ($scr.Get "primary") "#fff" }} @@ -179,21 +192,6 @@ {{ end }} {{ end }} - {{/* Load Google Fonts if the site's Font Theme uses them. */}} - {{/* Note: we cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}} - {{ with ($scr.Get "google_fonts") }} - {{ if hasPrefix . "family=" }} - {{/* If `google_fonts` starts with "family=", use API v2 (https://developers.google.com/fonts/docs/css2) */}} - - - {{ else }} - {{/* Otherwise, use API v1 */}} - {{/* Hugo's htmlEscape cannot escape "|" in Google Font URIs so we implement our own escape functionality. */}} - - {{ warnf "There is a new version of Google Fonts. Learn how to upgrade your font pack at https://wowchemy.com/docs/customization/#custom-font" }} - {{ end }} - {{ end }} - {{ $license := printf "/*! Wowchemy v%s | https://wowchemy.com/ */\n" site.Data.wowchemy.version }} {{ $license := $license | printf "%s/*! Copyright 2016-present George Cushen (https://georgecushen.com/) */\n" }} {{ $license := $license | printf "%s/*! License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */\n" }} diff --git a/wowchemy/layouts/partials/site_js.html b/wowchemy/layouts/partials/site_js.html index 6cad0ec4..7dcca5f7 100644 --- a/wowchemy/layouts/partials/site_js.html +++ b/wowchemy/layouts/partials/site_js.html @@ -17,7 +17,7 @@ {{ if not ($scr.Get "use_cdn") }} {{ else }} - {{ $require_isotope := site.Params.require_isotope | default true }} + {{ $require_isotope := .Params.require_isotope | default site.Params.require_isotope | default true }} {{ if $require_isotope }} {{ printf "" (printf $js.imagesLoaded.url $js.imagesLoaded.version) $js.imagesLoaded.sri | safeHTML }} {{ printf "" (printf $js.isotope.url $js.isotope.version) $js.isotope.sri | safeHTML }}