Skip to content

Commit 8ea353a

Browse files
committed
Optimize font loading by adding preload for Google Fonts
1 parent 557aad5 commit 8ea353a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

layouts/partials/head.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@
127127
{{ $url := printf "%s" "&display=swap" | printf "%s%s" $fontParam | printf "%s%s" $baseUrl | printf "%s" }}
128128
<link rel="preconnect" href="https://fonts.googleapis.com" />
129129
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
130-
<link href="{{ $url }}" rel="stylesheet" />
130+
<link rel="preload" as="style" href="{{ $url }}" />
131+
<link href="{{ $url }}" rel="stylesheet" media="print" onload="this.media='all'" />
131132
{{- end -}}
132133

133134
<!-- Favicons -->

0 commit comments

Comments
 (0)