@@ -35,6 +35,35 @@ const { imageUrl, title } = Astro.props;
3535const canonicalURL =
3636 Astro .props .canonicalURL ?? new URL (Astro .url .pathname , Astro .site );
3737const description = Astro .props .description ?? starpodConfig .description ;
38+
39+ function extractDomain(url : string ): string | null {
40+ try {
41+ return new URL (url ).hostname ;
42+ } catch {
43+ return null ;
44+ }
45+ }
46+
47+ function getExternalDomains(): string [] {
48+ const domains = new Set <string >();
49+ const siteHostname = Astro .site ?.hostname ;
50+
51+ // Add RSS feed domain
52+ const feedDomain = extractDomain (starpodConfig .rssFeed );
53+ if (feedDomain && feedDomain !== siteHostname ) {
54+ domains .add (feedDomain );
55+ }
56+
57+ // Add image domain if it's external
58+ const imageDomain = extractDomain (show .image );
59+ if (imageDomain && imageDomain !== siteHostname ) {
60+ domains .add (imageDomain );
61+ }
62+
63+ return Array .from (domains );
64+ }
65+
66+ const externalDomains = getExternalDomains ();
3867---
3968
4069<!doctype html >
@@ -92,10 +121,45 @@ const description = Astro.props.description ?? starpodConfig.description;
92121
93122 <meta property =" og:site_name" content ={ show .title } />
94123
95- <link rel =" preload" as =" image" href ={ show .image } />
124+ <!-- Preload critical resources for faster LCP -->
125+ <link rel =" preload" as =" image" href ={ show .image } fetchpriority =" high" />
96126
97127 <Font cssVariable =" --astro-font-inter" preload />
98128
129+ <!-- DNS prefetch for external resources -->
130+ {
131+ externalDomains .map ((domain ) => (
132+ <>
133+ <link rel = " dns-prefetch" href = { ` //${domain } ` } />
134+ <link rel = " preconnect" href = { ` https://${domain } ` } crossorigin />
135+ </>
136+ ))
137+ }
138+
139+ <!-- Prefetch for Vercel image optimization -->
140+ { Astro .site && <link rel = " preconnect" href = { Astro .site .origin } />}
141+
142+ <!-- Critical CSS for LCP optimization -->
143+ <style >
144+ /* Critical styles for above-the-fold content */
145+ body {
146+ font-family: 'Inter', system-ui, sans-serif;
147+ margin: 0;
148+ }
149+
150+ .atropos-inner img {
151+ max-width: 100%;
152+ height: auto;
153+ display: block;
154+ }
155+
156+ /* Ensure LCP image renders quickly */
157+ .show-art img {
158+ content-visibility: auto;
159+ contain: layout style paint;
160+ }
161+ </style >
162+
99163 <Schema
100164 slot =" head"
101165 item ={ {
@@ -133,6 +197,7 @@ const description = Astro.props.description ?? starpodConfig.description;
133197 <div class =" relative z-10 mx-auto lg:min-h-full lg:flex-auto" >
134198 <div
135199 class =" bg-light-card dark:bg-dark-card m-2 rounded-lg pt-10 pb-4 lg:pt-16 lg:pb-12"
200+ style =" contain: layout style;"
136201 >
137202 <ShowArtwork image ={ show .image } />
138203
@@ -167,6 +232,7 @@ const description = Astro.props.description ?? starpodConfig.description;
167232 <div class =" relative mt-2 pt-16" >
168233 <div
169234 class =" bg-gradient-light dark:bg-gradient-dark absolute top-0 right-0 left-0 z-0 h-80 w-full opacity-30"
235+ style =" content-visibility: auto;"
170236 >
171237 </div >
172238
0 commit comments