Skip to content

Commit dc68370

Browse files
committed
optimized google font loading
1 parent 94b01bf commit dc68370

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/BaseHead.astro

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,17 @@ function formatCanonicalURL(url: string | URL) {
4949
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
5050
<link
5151
href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap"
52-
rel="stylesheet"
52+
rel="preload"
53+
as="style"
54+
onload=`this.onload=null;this.rel='stylesheet'`
5355
/>
56+
<noscript>
57+
<link
58+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap"
59+
rel="stylesheet"
60+
type="text/css"
61+
/>
62+
</noscript>
5463

5564
<!-- Low Priority Global Metadata -->
5665
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />

0 commit comments

Comments
 (0)