Skip to content

React i18n and SEO: why Google only indexes one language of your site

A site in four languages that shows up in search in one does not have a content problem. It has a single line of JavaScript in the wrong place. What decides whether Google indexes every translation, and the checklist to test your own.

Ramon Gomes 12 min read Level: Intermediate

Also available in: Español, Français, Português

A site of mine sat online for months in four languages. Search Console showed one.

It was not a penalty. It was not thin content, and it was not a shortage of inbound links. All four versions existed, the copy was translated, and the language switcher in the header worked every time I clicked it. To Google, that site still spoke a single language.

It took me longer than I would like to admit to find out why, because the mistake was not in anything I had read about SEO. It was in one line of JavaScript I had written months earlier without a second thought.

This piece is about that line and the other decisions that determine whether a multilingual site gets indexed whole or in quarters. The examples are React i18n and Next.js because that is where I work, but the reasoning holds for Astro, Nuxt or Rails. The search engine has no idea which framework you used. It only sees the HTML that arrived.

The Symptom: Four Languages, One Set of Results

Diagnosis starts in Search Console, under Performance, filtered by page. If your site ships four languages and the list of pages with impressions only contains addresses from one of them, you already have your answer.

The second clue is the count. Say you published forty pages: ten articles in four languages. The indexing report shows ten. Not eleven, not thirty-eight. Exactly a quarter. That clean fraction is not a coincidence, it is the signature of this problem.

The third clue is the bluntest. Paste the URL of a translated page into URL Inspection. When Google says the page is unknown, it is not being coy. It has never found that address, often because that address does not exist.

What an I18n Library Solves, and What It Does Not

Before blaming the tool, it helps to pull apart two things that usually get lumped together.

Translation is the problem of picking the right sentence for each language. Libraries like react-i18next, next-intl and react-intl (from FormatJS) handle it: where strings live, interpolation, plurals, dates and numbers. A good chunk of that work is not even theirs. Dates, numbers, currency and plural selection come from JavaScript's built-in Intl APIContract that defines how one program asks another for data or actions: which endpoints to call, what to send and what comes back. On the web, usually HTTP with JSON. (MDN), which sits on Unicode CLDR data. That is why English has two plural forms and Arabic has six: the categories zero, one, two, few, many and other are defined in CLDR, and the message syntax most libraries accept is ICU MessageFormat.

Addressing is a different problem. No translation library decides on its own whether /pt/blog exists, writes your hreflang tags, or makes sure the language switcher is a real link. Some, like next-intl, help with routing if you set it up. The responsibility still sits with your application.

Mixing the two up is how a team ends up saying "our site has i18n" while three quarters of it is invisible in search. Having i18n set up is necessary and not enough: the text is translated, and nobody can reach it.

The Crawler Does Not Click Your Switcher

This is the point that trips up almost everyone, me included.

A browser with a person behind it is a rich environment. It has navigator.language, it has localStorage, it has someone willing to click and wait for the screen to change. A crawler has none of that. It requests a URL, reads the HTML, renders the JavaScript when it can, and follows the links it finds. Google is blunt about which links count: only <a> elements with an href attribute (Google Search Central, crawlable links).

What the browser has available compared with what the crawler has

So if the page language lives in React state, the crawler sees the initial value. Every time. A useState('en') is en for Googlebot on every visit. What it indexed was not the English version out of preference. It was the only version that existed from where it stood.

Which leads to the consequence that solves the whole mystery: one URL does not rank in four languages. There is one address, so there is one thing to index. The other three translations did not lose the contest. They never entered it.

Globe with four doors and a crawler spider on a path reaching only the open door
Without an accessible address for each language, the crawler finds only one of the four doors.

The Reciprocity Rule Nobody Quotes

Say each language already has its own URL. The next step is telling the search engine those pages are the same thing in different languages. That is what hreflang does: it lists the localized versions of a page. It can live in the <head>, in an HTTP header or in the sitemapFile, usually XML, that lists the URLs of a site with their update dates, helping search engines discover and crawl the pages..

html
<link rel="alternate" hreflang="en"    href="https://example.com/blog/post" />
<link rel="alternate" hreflang="pt-BR" href="https://example.com/pt/blog/artigo" />
<link rel="alternate" hreflang="es"    href="https://example.com/es/blog/articulo" />
<link rel="alternate" hreflang="x-default" href="https://example.com/blog/post" />

Google's documentation has a condition that slips past on a quick read: if two pages don't both point to each other, the tags are ignored (Google Search Central, localized versions). The reason is sound. Without that rule, any site could declare itself a translation of yours.

A reciprocal hreflang set works; a one-way set gets discarded

In practice, reciprocity breaks for a dull reason. Each language has its own slug, because translating the URL is part of the job. The alternates for the English page get built from one source, the Portuguese page's from another, and the two disagree. Each version announces a different set.

What I do is keep a single function that returns the full set of alternates and call it on all four pages. If every version derives from the same list, they cannot drift apart. That function follows three rules, all from the same Google page:

  1. URLs are absolute, with https:// and the domain. A bare /pt/blog does not count.
  2. The page lists itself, with its own language.
  3. There is an x-default, which is where anyone who speaks none of the options lands.

The codes follow BCP 47: a lowercase language, an optional region after the hyphen, as in pt-BR or fr-CA. The W3C has a short guide to language tags that is worth five minutes.

Where Each Language Lives

There are three ways to give each language its own address, and Google compares them in managing multi-regional and multilingual sites.

Country domains, subdomains and subdirectories compared

A country domain (example.co.uk, example.fr) is the strongest geographic signal. It is also the most expensive: one domain per market, and the authority each one earns does not add up with the others. It makes sense when you run a real operation in each country.

A subdomain (pt.example.com) sits in the middle. Easy to host somewhere else, weaker as a geographic signal.

A subdirectory (example.com/pt/) is the default for nearly everyone, and it is mine. One domain, one pool of authority, and a link someone gives the French version helps the whole site. If you do not have a marketing team per country, this decision is already made.

A URL Prefix Is Not a Language Code

This looks like a small detail until it breaks.

The prefix in the URL and the code in hreflang are different things. Nobody wants to read /pt-BR/blog in the address bar, but the search engine needs to know it is Brazilian Portuguese and not European. And the default language usually has no prefix at all: the site root already is it.

So the conversion is not string concatenation. It is a map, and it deserves to live in one file:

ts
export const localePrefix = {
  en: '',
  'pt-BR': 'pt',
  es: 'es',
  fr: 'fr',
} as const;

export function localizedPath(path: string, locale: Locale): string {
  const prefix = localePrefix[locale];
  return prefix === '' ? path : `/${prefix}${path}`;
}

Every time I have seen that map scattered across a codebase, the English page ended up with an hreflang pointing at /en/blog, an address that does not exist. The annotation points at a 404, reciprocity breaks, and the whole pair gets dropped.

In Next.js with the App Router, the same map feeds generateMetadata, which takes alternates in alternates.languages and writes the <link rel="alternate" hreflang> tags into the HTML (Next.js docs):

ts
export async function generateMetadata({ params }): Promise<Metadata> {
  const { locale, slug } = await params;

  return {
    alternates: {
      canonical: absoluteUrl(locale, slug),
      languages: alternatesFor(slug), // the same function on all four pages
    },
  };
}

Here is the line that cost me months.

tsx
// The crawler sees nothing here. There is no address to follow.
<button onClick={() => setLocale('pt-BR')}>Português</button>
tsx
// Now there is an address, and it is in the HTML.
<Link href="/pt/blog/artigo" hrefLang="pt-BR" lang="pt-BR">
  Português
</Link>

The difference is not cosmetic. Without <a href> in the HTML, there is no path from the crawler to the translated version, and your hreflang tags describe pages it cannot reach by navigating.

One thing that catches people: router.push() inside an onClick does not fix it either. Programmatic navigation leaves nothing in the HTML. Next's <Link> works because it renders a real anchor with a real href and only intercepts the click afterwards.

The test takes ten seconds:

bash
curl -s https://example.com/blog/post | grep -o 'href="[^"]*/pt/[^"]*"'

If nothing comes back, your switcher is invisible.

Redirecting by Browser Language Hides Content

The temptation is real: read the Accept-Language header and send every visitor straight to their language.

My rule has two parts. A URL with an explicit prefix is never redirected, because whoever opened /pt/blog already said what they want. And at the root, instead of redirecting, I show a quiet banner with a real link to the detected language. Suggesting costs one click from someone who was already in the right place. Forcing costs three quarters of the site.

If you insist on redirecting, store the choice and respect it. Redirecting someone who just switched language by hand is the fastest way to get them to close the tab.

Canonical, Sitemap and How to Actually Verify

In the sitemap, either declare the alternates with xhtml:link on each entry, or keep them only in the <head>. What matters is not having two sources saying different things.

Two more warnings that save time. The lang attribute on <html> helps screen readers and machine translation, but Google uses neither it nor hreflang to detect a page's language: it reads the text. And the International Targeting report in Search Console, where every old tutorial tells you to look, has been deprecated. Google still uses hreflang; the screen is just gone. What is left is testing what the crawler actually gets:

bash
# 1. Are the alternates in the raw HTML, before any JavaScript?
curl -s https://example.com/pt/blog/artigo | grep hreflang

# 2. Does the translated text arrive from the server, or only after hydration?
curl -s https://example.com/pt/blog/artigo | grep -c "a word that only exists in Portuguese"

# 3. What does the search engine already know about each language?
#    Search on Google:  site:example.com/pt

The third is the most honest. It tells you how many pages in each language made it into the index, not how many you think you published.

The Checklist

This is the order I fix things in, and it works for any React i18n stack or outside React.

  1. Each language has its own URL, served already translated by the server
  2. The language switcher renders <a href> in the HTML, not onClick
  3. hreflang tags are reciprocal, absolute and include the page itself
  4. There is an x-default pointing at the entry language
  5. The URL prefix and the hreflang code come from the same map
  6. Each version's canonical points at itself
  7. No URL with an explicit prefix is redirected by Accept-Language
  8. If the sitemap declares alternates, it agrees with the <head>

What I wish I had understood earlier is that none of this is SEO fine-tuningFurther training of an existing model on your own examples to adjust style, format or specialty. It changes the model's weights, unlike just editing the prompt.. It is not bonus points on top of a site that already works. It is the difference between a multilingual site and a one-language site with three translations nobody can find. The SEO basics that apply to any site, including what changes with AI search, are in the SEO and GEO guide.

The good news is that the fix tends to be small. In my case it was a prefix map, an alternates function, and a <button> that became a <Link>. The hard part, translating everything, I had done months before.

FAQ

Why does Google only index one language of my React site?

Because, as far as it can tell, there is only one address. If the language changes through component state or localStorage, the URL is the same in every language, and the crawler always gets the initial one.

Do react-i18next or next-intl fix this on their own?

No. They handle translation. A URL per language, hreflang and a link-based switcher are routing, and they are your application's job, even when the library helps you set them up.

Do I need hreflang if every language already has a URL?

It is not required for indexing, but it is what tells Google the pages are versions of each other, so it can show each person the right one.

Is the lang attribute on <html> enough?

Not for Google. It detects language from the content and does not use lang for that. Keep lang anyway, for accessibility.

Can I redirect based on the browser language?

At the root, carefully, and remembering the choice. On a URL that already carries a language prefix, no: Googlebot does not send Accept-Language and would always land on the default version.

References

Published in August 2026. Revised in October 2026 with references and Google's current guidance.

Source: https://ramongomessilva.com.br/blog/react-i18n-seo-google-only-indexes-one-language · Accessed on December 02, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. React i18n and SEO: why Google only indexes one language of your site. Ramon Gomes, 27 ago. 2026. Disponível em: https://ramongomessilva.com.br/blog/react-i18n-seo-google-only-indexes-one-language. Acesso em: 2 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, August 27). React i18n and SEO: why Google only indexes one language of your site. Ramon Gomes. https://ramongomessilva.com.br/blog/react-i18n-seo-google-only-indexes-one-language

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026reacti18nseo,
  author = {Gomes, Ramon},
  title = {{React i18n and SEO: why Google only indexes one language of your site}},
  organization = {Ramon Gomes},
  year = {2026},
  month = aug,
  date = {2026-08-27},
  url = {https://ramongomessilva.com.br/blog/react-i18n-seo-google-only-indexes-one-language},
  urldate = {2026-12-02}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles