From ab4c4fb81709e3b6cf20676191927b7c9c7cb550 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Wed, 27 Aug 2025 11:18:32 -0400 Subject: [PATCH 1/2] Add font preconnect and preloading --- layout/theme.liquid | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/layout/theme.liquid b/layout/theme.liquid index 8123ab78..03f5ba04 100644 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -4,6 +4,19 @@ {% # Inlined CSS Variables %} {% render 'css-variables' %} + {% comment %} + Font preloading: + 1. Preconnect to font CDN for faster connection + 2. Preload only the critical font variant (base weight) + 3. Additional variants load on-demand via @font-face + {% endcomment %} + {% unless settings.type_primary_font.system? %} + + + {% comment %} Preload the base font variant for initial page render {% endcomment %} + {{ settings.type_primary_font | font_url | preload_tag: as: 'font' }} + {% endunless %} + {% # Load and preload the critical CSS %} {{ 'critical.css' | asset_url | stylesheet_tag: preload: true }} From 61f61bb581542d77303ccf30d6017a3c93d4fc63 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Fri, 7 Nov 2025 07:40:39 -0600 Subject: [PATCH 2/2] Update layout/theme.liquid Co-authored-by: Guilherme Carreiro --- layout/theme.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/theme.liquid b/layout/theme.liquid index 03f5ba04..0e3fd39c 100644 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -14,7 +14,7 @@ {% comment %} Preload the base font variant for initial page render {% endcomment %} - {{ settings.type_primary_font | font_url | preload_tag: as: 'font' }} + {{ settings.type_primary_font | font_url | preload_tag: as: 'font', crossorigin: 'anonymous' }} {% endunless %} {% # Load and preload the critical CSS %}