浏览代码

perf: pre-connect to Google Fonts if using Google Fonts

Increase performance.
George Cushen 4 年之前
父节点
当前提交
07facf5828
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 1 1
      layouts/partials/site_footer.html
  2. 6 0
      layouts/partials/site_head.html

+ 1 - 1
layouts/partials/site_footer.html

@@ -21,7 +21,7 @@
   <p class="powered-by">
     {{ if not site.Params.i_am_a_sponsor }}
     Published with
-    <a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic Website Builder</a>
+    <a href="https://wowchemy.com" target="_blank" rel="noopener">Wowchemy Website Builder</a>
     {{ end }}
 
     {{ if not (in (slice "book" "docs" "updates") .Type) }}

+ 6 - 0
layouts/partials/site_head.html

@@ -44,6 +44,12 @@
   <link rel="alternate" hreflang="{{ site.LanguageCode | default "en-us" }}" href="{{ .Permalink }}">
 
   {{ partial "functions/parse_theme" . }}
+
+  {{/* Pre-connect to Google Fonts if the site's Font Theme uses them. */}}
+  {{ with ($scr.Get "google_fonts") }}
+    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+  {{end}}
+
   {{ $css := site.Data.assets.css }}
   {{ $js := site.Data.assets.js }}
   {{ if ne ($scr.Get "primary") "#fff" }}