diff --git a/files/framework/astro-lite/src/layouts/layout.astro b/files/framework/astro-lite/src/layouts/layout.astro index 908814e..a8fae60 100644 --- a/files/framework/astro-lite/src/layouts/layout.astro +++ b/files/framework/astro-lite/src/layouts/layout.astro @@ -3,13 +3,49 @@ import '../global.css'; import { ClientRouter } from 'astro:transitions'; import { Font } from 'astro:assets'; import { Nav } from '../components/nav'; +import { seoConfig } from '../seo.config'; type Props = { title: string; brand: string; + description?: string; + keywords?: string; }; -const { title, brand } = Astro.props; +const { title, brand, description, keywords } = Astro.props; + +const pageDescription = description ?? seoConfig.siteDescription; +const pageKeywords = keywords ?? seoConfig.keywords; + +const jsonLd = seoConfig.siteUrl && seoConfig.siteName && pageDescription + ? JSON.stringify({ + '@context': 'https://schema.org', + '@type': 'WebSite', + publisher: { + '@type': 'Organization', + name: seoConfig.publisherName, + url: seoConfig.siteUrl, + logo: { + '@type': 'ImageObject', + url: seoConfig.publisherLogoUrl, + width: Number(seoConfig.publisherLogoWidth), + height: Number(seoConfig.publisherLogoHeight), + }, + }, + image: { + '@type': 'ImageObject', + url: seoConfig.ogImage, + width: Number(seoConfig.ogImageWidth), + height: Number(seoConfig.ogImageHeight), + }, + url: seoConfig.siteUrl, + mainEntityOfPage: { + '@type': 'WebPage', + '@id': seoConfig.siteUrl, + }, + ...(pageDescription ? { description: pageDescription } : {}), + }) + : null; --- @@ -22,6 +58,35 @@ const { title, brand } = Astro.props; {title} + + + {pageDescription && } + + + {seoConfig.siteUrl && } + + + {seoConfig.siteName && } + + + {pageDescription && } + {seoConfig.siteUrl && } + + + + + + + + + + {pageDescription && } + {seoConfig.siteUrl && } + + + + {jsonLd &&