Localized SEO and navigation
What you need to know
Localized SEO connects genuinely equivalent translated pages using reciprocal language alternates, while each distinct language page normally points its canonical to itself.
By the end, you can: define reciprocal alternate URLs; test language switching.
English-only metadata for a published guide
import type {Metadata} from 'next';export const metadata:Metadata={alternates:{canonical:'https://books.example/en/catalog/river-walks'}};Expected behavior: A self-canonical is emitted; there is no alternate for an unavailable translation.
How it works
A language switcher should link to the equivalent resource in a supported, published locale, not blindly replace URL segments or send users to an unrelated home page. Keep a stable resource identifier separate from translated slugs. If a translation is missing, omit its alternate and disable or omit that language choice with a clear explanation; do not advertise a duplicate English page as Persian. Use alternates.languages with fully qualified URLs built from trusted configuration. Each language version should list itself and its corresponding published variants; search systems may ignore inconsistent reciprocal links. x-default is optional and should identify a genuine default or chooser, not every missing translation. A canonical is distinct from a language alternate. Verify the page language, actual content, canonical, reciprocal alternates, language-switcher destination and HTTP response in production. The V12 fixture only has English, so it emits a self-canonical and no fabricated Persian alternate. A separate data model can show how a future pair would be generated without publishing it.
Future reciprocal language metadata, design only
{ "en": { "canonical": "https://books.example/en/catalog/river-walks", "languages": { "en": "https://books.example/en/catalog/river-walks", "fa": "https://books.example/fa/catalog/river-walks" } }, "fa": { "canonical": "https://books.example/fa/catalog/river-walks", "languages": { "en": "https://books.example/en/catalog/river-walks", "fa": "https://books.example/fa/catalog/river-walks" } }}Expected behavior: This hypothetical pair is not part of the published fixture. Emit it only after both translations exist and have been verified.
Common mistake
Do not invent hreflang targets for untranslated pages or force all locale canonicals to English. A language switch should preserve the resource, not necessarily its literal slug.
Practice and verification
Create a resource map containing one English-only guide and a hypothetical translated pair. Generate navigation and alternate lists only for actually published variants. Verify the reciprocal set before publishing any translations.
Scope: Proposed Next.js 16.x / React 19, Cache Components disabled unless noted. Framework and browser examples are staged; local standalone tests are reported separately. Exact dependency patches and platform contracts pending.