diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 0196911..01586a8 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,17 +1,21 @@ --- import { WEBMENTION_PINGBACK, WEBMENTION_URL } from "astro:env/client"; -import { siteConfig } from "@/site.config"; +import { siteConfig, socialLinks } from "@/site.config"; import type { SiteMeta } from "@/types"; import "@/styles/global.css"; type Props = SiteMeta; -const { articleDate, description, ogImage, title } = Astro.props; +const { articleDate, description, keywords, ogImage, schema, title } = Astro.props; const titleSeparator = "•"; const siteTitle = `${title} ${titleSeparator} ${siteConfig.title}`; const canonicalURL = new URL(Astro.url.pathname, Astro.site); const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url).href; + +const xLink = socialLinks.find((s) => s.friendlyName === "X")?.link; +const twitterHandle = xLink ? `@${xLink.split("/").pop()}` : undefined; +const schemas = schema ? (Array.isArray(schema) ? schema : [schema]) : []; --- @@ -38,8 +42,15 @@ const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url {/* Primary Meta Tags */} +{keywords && keywords.length > 0 && } +{/* Tell crawlers to index and allow full image/snippet/video previews */} + + {/* Open Graph / Facebook */} @@ -48,6 +59,7 @@ const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url + { @@ -65,6 +77,11 @@ const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url +{twitterHandle && } +{twitterHandle && } + +{/* Structured data (schema.org JSON-LD) */} +{schemas.map((s) =>