Skip to content

Commit 7e5fcb4

Browse files
committed
add preconnect and preloads to improve load times
1 parent 954d8ed commit 7e5fcb4

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

assets/scss/_fonts.scss

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,6 @@
1818
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
1919
}
2020

21-
/* Merriweather Light 300 */
22-
@font-face {
23-
font-family: 'Merriweather';
24-
font-style: normal;
25-
font-weight: 300;
26-
font-display: swap;
27-
src: url('/fonts/merriweather-300-latin.woff2') format('woff2');
28-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
29-
}
30-
31-
/* Merriweather Light 300 Italic */
32-
@font-face {
33-
font-family: 'Merriweather';
34-
font-style: italic;
35-
font-weight: 300;
36-
font-display: swap;
37-
src: url('/fonts/merriweather-300italic-latin.woff2') format('woff2');
38-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
39-
}
4021

4122
/* Overpass Mono Variable (300-700) */
4223
@font-face {

layouts/_default/baseof.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
<meta name="viewport" content="width=device-width, initial-scale=1">
1414
<link rel="icon" type="image/png" href="{{ "favicon-32x32.svg" | relURL }}">
1515

16-
{{ partial "google-fonts.html" . }}
16+
<!-- CDN Preconnects -->
17+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
18+
19+
<!-- Preload Critical Fonts -->
20+
<link rel="preload" href="/fonts/outfit-400-latin.woff2" as="font" type="font/woff2" crossorigin>
1721

18-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap">
22+
{{ partial "google-fonts.html" . }}
1923

2024
<!-- CSS-->
2125
{{ $css_options := dict "targetPath" "css/style.css" "enableSourceMap" (not hugo.IsProduction) }}

layouts/partials/google-fonts.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{{/* Fonts are now self-hosted in assets/scss/_fonts.scss */}}
1+
{{/* Load Google Fonts */}}
2+
<link rel="preconnect" href="https://fonts.googleapis.com">
3+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4+
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&display=swap" rel="stylesheet">
5+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap">

0 commit comments

Comments
 (0)