diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro new file mode 100644 index 0000000..856ac7a --- /dev/null +++ b/src/layouts/Base.astro @@ -0,0 +1,55 @@ +--- +import { ViewTransitions } from 'astro:transitions' +import MetaTags from '@layouts/MetaTags.astro'; +// import NavBar from '@components/scafold/NavBar.astro'; +// import Footer from '@components/scafold/Footer.astro'; +// import config from '../site-config'; + +interface Props { + title?: string; + description?: string; + keywords?: string; + customSchemaJson?: any; + breadcrumbs?: Array<{ + name: string; + item: string; + }> +} + +--- + + + + + + + + + + + + + + + + + diff --git a/src/layouts/MetaTags.astro b/src/layouts/MetaTags.astro new file mode 100644 index 0000000..7a66762 --- /dev/null +++ b/src/layouts/MetaTags.astro @@ -0,0 +1,103 @@ +--- + +interface Props { + title?: string; + description?: string; + keywords?: string; + customSchemaJson?: any; + breadcrumbs?: Array<{ + name: string; + item: string; + }> +} + +// Default meta tag values +const siteInfo = { + title: 'Web Check', + description: '', + keywords: '', + author: 'Alicia Sykes', + twitter: '@Lissy_Sykes', + site: import.meta.env.SITE_URL || 'https://web-check.xyz', + analytics: { + enable: import.meta.env.ENABLE_ANALYTICS, + domain: 'web-check.xyz', + script: 'https://no-track.as93.net/js/script.js', + }, +}; + +// Set values for the meta tags, from props or defaults +const { + title = siteInfo.title, + description = siteInfo.description, + keywords = siteInfo.keywords, + breadcrumbs, + customSchemaJson, +} = Astro.props; + +// Set non-customizable values for meta tags, from the siteInfo +const { site, author, twitter, analytics } = siteInfo; + +// Given a map of breadcrumbs, return the JSON-LD for the BreadcrumbList schema +const makeBreadcrumbs = () => { + if (!breadcrumbs) return null; + return { + "@context": "https://schema.org", + "@type": "BreadcrumbList", + "itemListElement": breadcrumbs.map((breadcrumb, index) => ({ + "@type": "ListItem", + "position": index + 1, + "name": breadcrumb.name, + "item": `${site}/${breadcrumb.item}` + })) + } +} + +--- + + +{title} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{analytics.enable && ( + +)} + + +{breadcrumbs && ( +