diff --git a/src/layouts/BaseHtml.astro b/src/layouts/BaseHtml.astro index a1488db2..2a2ccc1a 100644 --- a/src/layouts/BaseHtml.astro +++ b/src/layouts/BaseHtml.astro @@ -25,7 +25,8 @@ const { ogMeta } = Astro.props; const baseUrl = getSiteUrl(); const hasSecondaryMenu = hasSecondaryMenuItem(Astro.url.pathname); -const canonicalUrl = generateCanonicalUrl(baseUrl, ogMeta?.slug); +const contentSlug = ogMeta?.slug || Astro.url.pathname; +const canonicalUrl = generateCanonicalUrl(baseUrl, contentSlug); ---