From d1e8cf4bd091f41c34f8ae5b2f5c6d4bb73de1f9 Mon Sep 17 00:00:00 2001 From: akash Date: Thu, 19 Feb 2026 19:24:10 +0530 Subject: [PATCH] Duplicate, Google chose different canonical than user render issus fixed --- src/ConsenHead.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ConsenHead.js b/src/ConsenHead.js index bbeb252..95d686b 100644 --- a/src/ConsenHead.js +++ b/src/ConsenHead.js @@ -6,7 +6,8 @@ const ConsenHead = ({ title, description }) => { const siteUrl = "https://metatroncubesolutions.com"; const cleanPath = router.asPath.split("?")[0]; - const canonicalUrl = `${siteUrl}${cleanPath === "/" ? "" : cleanPath}`; + // Ensure the URL always ends with a / because trailingSlash: true is set in next.config.js + const canonicalUrl = `${siteUrl}${cleanPath === "/" ? "/" : (cleanPath.endsWith("/") ? cleanPath : `${cleanPath}/`)}`; const defaultTitle = "Metatroncube: Leaders in Web & Mobile Dev, SEO, Digital Marketing"; const defaultDescription =