Guides

How to make a site in two languages — without losing it in search

Illustration: one page with two signposts in different languages

The most common move when adding a second language is also the most harmful: detect the country by IP and silently redirect people to "their" version. It looks thoughtful. What you actually did was hide half your site from search.

Google says outright not to do this: automatic redirects stop both people and crawlers from seeing your other versions. The crawler arrives from US addresses, gets bounced to the English version — and never sees the Russian one. So it isn't in the results.

The correct path is slightly more boring and takes an evening. Step by step.

1. Decide what the URLs look like

Three options, all valid:

  • Subfolders: site.com/ and site.com/ru/ — simplest, and all the domain's weight stays in one place. For a first site, take this.
  • Subdomains: ru.site.com — more setup, needs its own DNS record.
  • Separate domains: site.ru and site.com — expensive, justified for different markets.

The rule that holds for all three: every language gets its own URL. If both languages live at the same URL and a button swaps them without changing the address, only one will ever reach search. There's nothing for the crawler to index — it's one page.

What you get: two working links you can open in separate tabs.

2. Pull the texts out of your markup

While text is baked into the markup, a second language means a copy of every page — and permanent drift. Create one dictionary per language:

// locales/en.json
{ "hero.title": "Build your first app", "cta.start": "Get started" }

// locales/ru.json
{ "hero.title": "Собери своё приложение", "cta.start": "Начать" }

In code, the text becomes a key: t("hero.title"). The t function reads the language from the URL and pulls the right string.

Two rules that save pain later:

  • Name keys by meaning, not by text: cta.start, not get_started. The wording will change; the key shouldn't.
  • Don't assemble sentences from pieces. "You have" + number + "days left" falls apart in another language — different word order, different endings. Keep the whole phrase with a placeholder: "{n} days left".

What you get: one set of markup, two text files. A new language = one more JSON.

3. Add a visible switcher

People should pick the language themselves — that's what replaces the auto-redirect:

<a href="/ru/pricing" hreflang="ru">Русский</a>
<a href="/pricing" hreflang="en">English</a>

Two details people usually miss:

  • The switcher points at the same page in the other language, not at the homepage. Throwing someone from Pricing back to the front page is a reliable way to lose them.
  • You can remember the choice in a cookie and show a banner next time: "We have a Russian version" with a link. A banner is fine. A silent redirect is not.

What you get: one click takes you from any page to its twin.

4. Tell search the versions belong together

Otherwise Google sees two similar pages and decides one is a duplicate. Fix it with hreflang tags in every page's <head>:

<link rel="alternate" hreflang="ru" href="https://site.com/ru/pricing" />
<link rel="alternate" hreflang="en" href="https://site.com/pricing" />
<link rel="alternate" hreflang="x-default" href="https://site.com/pricing" />

Three rules everyone trips on:

  • The tags go on both pages and list every version, including the page itself. A one-way reference doesn't count.
  • URLs are absolute, with https:// and the domain.
  • x-default is where to send people whose language doesn't match anything. Usually the English version.

While you're in there, check <html lang="en"> and your localized meta tags: the title and description must be translated too, or your Russian page shows up with an English description.

What you get: Google understands it's one page in two languages and shows people the right one.

5. Verify the crawler sees both versions

Five minutes that save a month of waiting:

  1. Open both versions in a private window — does anything bounce you?
  2. Check both versions are in sitemap.xml.
  3. Make sure the second version isn't blocked in robots.txt.
  4. View page source (Ctrl+U) — are the hreflang tags there?
  5. Submit the sitemap in Google Search Console.

If a couple of weeks later search still shows one version, start with why your site isn't showing in Google.

What you end up with

Two versions of the site, each with its own URL and its own search description. Someone in Russia finds the Russian page, someone in Germany the English one, and either can switch with one click. A new language is one JSON file away, not a copy of the site.

Can I just use machine translation?

As a draft, yes. Published as-is, no. Unedited machine translation produces clumsy headings — and headings are exactly what shows in the results. Translate the homepage, pricing and page titles by hand; the rest can follow gradually.

What if I end up with five languages?

Same scheme, but hreflang on every page lists all five. At that point it's easier to generate the list in code from one array of languages than to write it by hand. For how search decides what to show in the first place, see what SEO is.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →