perf(fonts): defer Google Fonts load to avoid render-blocking

Use media='print' + onload swap trick to load the stylesheet
non-blocking. Add noscript fallback for JS-disabled browsers.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen 2026-03-24 12:55:04 +08:00
parent ec5687a8f1
commit f1799c2a44
No known key found for this signature in database
GPG Key ID: B93DE4F003C33630

View File

@ -25,7 +25,13 @@
<link
href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600&family=Manrope:wght@400;600;700;800&display=swap"
rel="stylesheet"
media="print"
onload="this.media='all'"
/>
<noscript><link
href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600&family=Manrope:wght@400;600;700;800&display=swap"
rel="stylesheet"
/></noscript>
<link rel="stylesheet" href="/static/style.css" />
<script
async