diff --git a/public/og-image.png b/public/og-image.png index 3506bf7..cb0a713 100644 Binary files a/public/og-image.png and b/public/og-image.png differ diff --git a/public/og/kasuti.png b/public/og/kasuti.png new file mode 100644 index 0000000..c183ace Binary files /dev/null and b/public/og/kasuti.png differ diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 7f15ed8..6cebbc9 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -17,7 +17,7 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site); const { title, description, image } = Astro.props; const finalTitle = title && title !== SITE_METADATA.title.default - ? `${title} | Hatch` + ? `${title} | Interactives` : title || SITE_METADATA.title.default; const finalDescription = description || SITE_METADATA.description; const finalImage = image || SITE_METADATA.openGraph.images[0].url; diff --git a/src/layouts/InteractiveLayout.astro b/src/layouts/InteractiveLayout.astro index 191c7d9..2e608d8 100644 --- a/src/layouts/InteractiveLayout.astro +++ b/src/layouts/InteractiveLayout.astro @@ -1,4 +1,7 @@ --- +import fs from "node:fs"; +import path from "node:path"; + import BaseHead from "@/components/BaseHead.astro"; import { Footer } from "@/components/sections/footer"; import Navbar from "@/components/sections/navbar"; @@ -21,11 +24,16 @@ interface Props { const { title, description, slug, themes, subcategory, tags, status } = Astro.props; const currentUrl = new URL(Astro.url.pathname, Astro.site).toString(); const embedUrl = new URL(`/embed/${slug}`, Astro.site).toString(); + +// If public/og/.png exists, use it as the preview card image; otherwise the +// site-wide default in BaseHead applies. +const ogCandidate = path.join(process.cwd(), "public", "og", `${slug}.png`); +const ogImage = fs.existsSync(ogCandidate) ? `/og/${slug}.png` : undefined; --- - +