Skip to content

Commit a5ac740

Browse files
committed
chore: include lang param in canonical url if present
1 parent f96be2f commit a5ac740

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Layout/MDXWrapper.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ const MDXWrapper: React.FC<MDXWrapperProps> = ({ children, pageContext, location
182182
const metaTitle = getMetaTitle(title, (activePage.product as ProductName) || META_PRODUCT_FALLBACK) as string;
183183

184184
const { canonicalUrl } = useSiteMetadata();
185-
const canonical = canonicalUrl(location.pathname);
185+
const langParam = new URLSearchParams(location.search).get('lang');
186+
const canonical = langParam
187+
? canonicalUrl(`${location.pathname}?lang=${langParam}`)
188+
: canonicalUrl(location.pathname);
186189

187190
// Generate JSON-LD structured data for SEO
188191
const structuredData: StructuredData | undefined = useMemo(() => {

0 commit comments

Comments
 (0)