Fix canonical in a safe way (#2589)

This commit is contained in:
Greg Bergé
2024-12-10 17:47:57 +01:00
committed by GitHub
parent e85d357abd
commit 35eae1adcf
@@ -150,7 +150,8 @@ export async function generateMetadata({
.join(' | '),
description: page.description ?? '',
alternates: {
canonical: absoluteHref(getPagePath(pages, page), true),
// Trim trailing slashes in canonical URL to match the redirect behavior
canonical: absoluteHref(getPagePath(pages, page), true).replace(/\/+$/, ''),
},
openGraph: {
images: [