Duplicate, Google chose different canonical than user render issus fixed

This commit is contained in:
akash 2026-02-19 19:24:10 +05:30
parent 5b6821cce9
commit d1e8cf4bd0

View File

@ -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 =