Canonical
Give each localized page its own canonical
If /en/pricing and /fr/pricing are separate language pages, each should normally identify itself as the canonical URL for that language version. Do not canonicalize every translation to English simply because English was published first.
- Canonicalize the exact protocol, host, path, and locale URL you want indexed.
- Keep redirected, parameterized, or duplicate variants out of the canonical set.
- Use the same canonical policy in metadata and the sitemap.
export async function generateMetadata({ params }) {
const { locale, slug } = await params;
const product = await getProduct(slug);
const path = `/products/${product.slug}`;
return {
title: product.seoTitle[locale],
description: product.seoDescription[locale],
alternates: {
canonical: `https://example.com/${locale}${path}`,
languages: {
en: `https://example.com/en${path}`,
fr: `https://example.com/fr${path}`,
de: `https://example.com/de${path}`,
},
},
};
}