From bf0249c6f65f0adbb271cc87cf23d9612f20a6ad Mon Sep 17 00:00:00 2001 From: Archie Wood <58074498+archiewood@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:15:33 -0500 Subject: [PATCH] allow overrides --- sites/docs/pages/+layout.svelte | 20 ++++++++++++++++++-- sites/docs/pages/index.md | 2 -- sites/docs/pages/motivation/index.md | 2 -- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/sites/docs/pages/+layout.svelte b/sites/docs/pages/+layout.svelte index c6878290eb..cbbececfb7 100644 --- a/sites/docs/pages/+layout.svelte +++ b/sites/docs/pages/+layout.svelte @@ -6,6 +6,17 @@ export let data; import { page } from '$app/stores'; let pageRoute = $page.route.id.replace(/\/$/, '') + + // Check if the page has an og:image set in the frontmatter + let tree = data.pagesManifest + let frontMatter = undefined + for (const part of $page.route.id.split('/').slice(1)) { + tree = tree.children[part] + frontMatter = tree?.frontMatter + } + const ogImageOverride = frontMatter?.og?.image || undefined + + @@ -13,8 +24,13 @@ - - + {#if ogImageOverride} + + + {:else} + + + {/if}