File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,23 @@ import Default from '@astrojs/starlight/components/Head.astro';
33
44const pageTitle = Astro .locals .starlightRoute ?.entry ?.data ?.title ?? ' Sprites Documentation' ;
55const ogImageUrl = ` https://og-images.fly.dev/image?template=sprites&text=${encodeURIComponent (pageTitle )} ` ;
6+ const slug = Astro .locals .starlightRoute ?.slug ?? Astro .locals .starlightRoute ?.id ;
7+ const isHomePage = slug === ' ' || slug === ' index' || slug === ' index.mdx' ;
8+
9+ const websiteSchema = {
10+ ' @context' : ' https://schema.org' ,
11+ ' @type' : ' WebSite' ,
12+ name: ' Sprites Documentation' ,
13+ url: ' https://docs.sprites.dev' ,
14+ };
615---
716
817<Default {... Astro .props }><slot /></Default >
918
1019<!-- Dynamic OG Image -->
1120<meta property =" og:image" content ={ ogImageUrl } />
1221<meta name =" twitter:image" content ={ ogImageUrl } />
22+
23+ { isHomePage && (
24+ <Fragment set :html = { ` <script type="application/ld+json">${JSON .stringify (websiteSchema )}</script> ` } />
25+ )}
You can’t perform that action at this time.
0 commit comments