feat: optimize performance and fix CLS issues

This commit is contained in:
Lorenzo Iovino 2026-01-09 16:40:37 +01:00
parent df04844ca2
commit 52f112568c
7 changed files with 88 additions and 17 deletions

View file

@ -170,13 +170,32 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`;
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="preload"
as="font"
type="font/woff2"
href="https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2"
crossorigin
/>
<style>
/* Fallback font ottimizzato per ridurre layout shift */
@font-face {
font-family: "Inter-fallback";
font-style: normal;
font-weight: 400 800;
src: local("Arial");
ascent-override: 90%;
descent-override: 22%;
line-gap-override: 0%;
size-adjust: 107%;
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400 800;
font-display: swap;
font-display: optional;
src: url(https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2)
format("woff2");
unicode-range:
@ -184,6 +203,17 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`;
U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
U+FFFD;
}
/* Previeni flash of unstyled content */
body {
font-family:
"Inter",
"Inter-fallback",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
}
</style>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />