From fa72e41091f31931cac1619257ed244de2f9678a Mon Sep 17 00:00:00 2001 From: Alex Moon Date: Mon, 3 Mar 2025 11:31:56 -0800 Subject: [PATCH] fix: correct canonical URLs and add canonical link --- src/components/seo.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/seo.jsx b/src/components/seo.jsx index 865601a3..a66ad942 100644 --- a/src/components/seo.jsx +++ b/src/components/seo.jsx @@ -1,6 +1,11 @@ import Head from "next/head"; export default function SEO({ title, description, imageUrl, url }) { + const canonicalUrl = url + ? // eslint-disable-next-line no-restricted-globals, n/prefer-global/process, n/prefer-global/url + new URL(url, process.env.NEXT_PUBLIC_SITE_URL) + : undefined; + return ( @@ -30,10 +35,11 @@ export default function SEO({ title, description, imageUrl, url }) { )} - {url && ( + {canonicalUrl && ( <> - - + + + )}