# Provide a crawlable language switcher

- Check 22.10 · International architecture · Critical
- Source: https://checklist-seo-geo.com/en/international-architecture/provide-crawlable-language-switcher
- Build a language switcher from real HTML links to each version, readable by crawlers and accessible, on WordPress, Shopify, Laravel and Next.js.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/international-architecture/provide-crawlable-language-switcher.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A crawlable language switcher is a list of ordinary HTML links, `<a href="…">`, present in the code returned by the server on every page, leading to the same page in each other language. No `<select>` that changes the page in JavaScript, no button that sets a cookie. Once this task is done, a crawler reading the raw HTML finds every language version, and a visitor changes language with one click or from the keyboard.

## Why it matters

Google recommends it in its documentation on multilingual sites: rather than redirecting automatically, add links to the other language versions on your pages to let users choose. Its documentation on links also states that it can only reliably follow `<a>` elements with an `href` attribute: a `<select>` option, a `<button>` or a `<span onclick>` are not links as far as Google is concerned.

Yet many themes and plugins ship a switcher that contains none:

- a `<select>` drop-down that triggers `window.location` on change;
- a form that sends the language via POST and lets the server redirect;
- `href="#"` links that a script fills in on click;
- a menu injected entirely by JavaScript after the page loads.

For a visitor, these variants work. For a crawler, the other languages are then only discovered through the `hreflang` annotations or the sitemap, and receive no internal link from the pages of the main language. Generative engine crawlers that do not run JavaScript do not see a script-injected switcher at all, and an AI agent browsing on behalf of a user relies on links and on the accessible names of elements.

The switcher is also an accessibility component: the name of each language written in that language (“Deutsch”, not “German”), announced correctly by screen readers thanks to the `lang` attribute.

## What it improves

- **Discovery of language versions**: every page passes a link to its equivalents, in addition to the `hreflang` annotations.
- **Internal linking by language**: translated pages receive links from all the other versions.
- **Visitor experience**: changing language without losing the page, working without JavaScript.
- **Accessibility**: keyboard navigation and correct reading of language names.
- **AI agents**: a language-switching path that can be read in the accessibility tree. A possible effect, not measured.
- **Rankings**: no direct effect.

## How to check

Look for the switcher's links in the HTML returned by the server, without running JavaScript:

```bash
curl -s https://example.com/fr/tarifs/ | grep -o -E '<a [^>]*hreflang="[^"]*"[^>]*>[^<]*'
```

Expected result: one line per language, with a full URL and the language name:

```txt
<a href="https://example.com/fr/tarifs/" hreflang="fr" lang="fr" aria-current="page">Français
<a href="https://example.com/de/preise/" hreflang="de" lang="de">Deutsch
<a href="https://example.com/en/pricing/" hreflang="en" lang="en">English
```

If your switcher does not use the `hreflang` attribute, search for the language names (`grep -o -E 'href="[^"]*"[^>]*>(Deutsch|English)'`). No result, while the switcher is visible in the browser, means it is built by JavaScript or does not use links.

Other checks:

- **Browser without JavaScript**: disable JavaScript in the developer tools (command menu, “Disable JavaScript”), reload and change language. It must work.
- **Crawl**: run Screaming Frog on the homepage of a single language, with JavaScript rendering disabled and without following `hreflang`. The other languages must appear among the crawled URLs.
- **Keyboard**: the Tab key must reach each language, and Enter must open it. See [test keyboard navigation of the language switcher](https://checklist-seo-geo.com/en/development-accessibility-language/test-keyboard-navigation-language-switcher).
- **Mobile**: check that the switcher also exists in the HTML of the mobile version, often in a collapsed menu.

## How to implement

### Before you start

The target markup, valid for every environment:

```html
<nav aria-label="Choose a language" class="lang-switcher">
  <ul>
    <li><a href="https://example.com/fr/tarifs/" hreflang="fr" lang="fr" aria-current="page">Français</a></li>
    <li><a href="https://example.com/de/preise/" hreflang="de" lang="de">Deutsch</a></li>
    <li><a href="https://example.com/en/pricing/" hreflang="en" lang="en">English</a></li>
  </ul>
</nav>
```

Rules:

| Do | Avoid |
|---|---|
| `<a href>` links present in the server's HTML | `<select onchange>`, buttons, POST forms, `href="#"` |
| A link to the equivalent page in each language | A link to each language's homepage |
| The language name in its own language, with `lang` | Flags alone, names translated into the current language |
| A switcher in the header or footer of every page | A switcher present only on the homepage |
| Followed links, without `nofollow` | `rel="nofollow"` on language links |

The `hreflang` attribute on the link indicates the language of the target page; `lang` is used by screen readers to pronounce the name. The W3C advises against flags for a simple choice of language: a flag represents a country, not a language. Keep them only if the choice really is about a country, and always alongside the name.

The switcher must point to the equivalent page: that is the subject of [link to the equivalent page rather than the homepage](https://checklist-seo-geo.com/en/international-architecture/link-equivalent-page-rather-than-homepage). If you want a drop-down menu, keep links inside it, for example with `<details>`, which opens without a script:

```html
<details class="lang-switcher">
  <summary>Français</summary>
  <ul>
    <li><a href="https://example.com/de/preise/" hreflang="de" lang="de">Deutsch</a></li>
    <li><a href="https://example.com/en/pricing/" hreflang="en" lang="en">English</a></li>
  </ul>
</details>
```

### WordPress

Versions: WordPress 6.8 and later; Polylang 3, WPML 5 and TranslatePress 3, November 2026.

- **Polylang**: add the switcher provided by the plugin to a menu (`Appearance > Menus`, “Language switcher” item), as a block or as a widget. It produces links. In a custom theme, use the plugin's function in raw data mode and write the markup yourself:

```php
<?php
$languages = pll_the_languages([
    'raw' => 1,
    'hide_if_no_translation' => 1,
]);
?>
<nav aria-label="<?php esc_attr_e('Choose a language', 'theme'); ?>">
    <ul>
        <?php foreach ($languages as $language) : ?>
            <li>
                <a href="<?php echo esc_url($language['url']); ?>" hreflang="<?php echo esc_attr($language['slug']); ?>" lang="<?php echo esc_attr($language['slug']); ?>">
                    <?php echo esc_html($language['name']); ?>
                </a>
            </li>
        <?php endforeach; ?>
    </ul>
</nav>
```

- **WPML**: the switcher is configured in `WPML > Settings > Language Switchers` (menu, widget, footer). The “list” styles produce links; check your theme's “drop-down” style with the curl test. For custom markup, the `wpml_active_languages` filter returns the URL (`url`) and native name (`native_name`) of each language.
- **TranslatePress**: the switcher is inserted with the `[language-switcher]` shortcode, in a menu or as a floating switcher; check the variant you chose with curl.
- **Script-based translation plugins**: if the links do not appear in the HTML returned by curl, add a link-based switcher in the footer, built from the URLs of each language.

Purge the page cache after the change.

### Shopify

Versions: Shopify, all plans, Online Store 2.0 themes, November 2026.

The switcher in Shopify themes relies on the localization form (`{% form 'localization' %}`): the options are `href="#"` links that fill a hidden field and then submit the form in JavaScript. Crawlers do not follow them. Shopify does, however, add the `hreflang` annotations in `content_for_header`, which lets the versions be discovered.

To add crawlable links, for example in `sections/footer.liquid`, build the URL of each language from the current path:

```liquid
{%- liquid
  assign current_root = request.locale.root_url
  assign base_path = request.path
  if current_root != '/'
    assign base_path = request.path | remove_first: current_root
  endif
  if base_path == ''
    assign base_path = '/'
  endif
-%}
<nav aria-label="Language">
  <ul>
    {%- for language in localization.available_languages -%}
      {%- if language.root_url == '/' -%}
        {%- assign target = base_path -%}
      {%- else -%}
        {%- assign target = language.root_url | append: base_path -%}
      {%- endif -%}
      <li>
        <a href="{{ target }}" hreflang="{{ language.iso_code }}" lang="{{ language.iso_code }}"{% if language.iso_code == localization.language.iso_code %} aria-current="page"{% endif %}>{{ language.endonym_name | capitalize }}</a>
      </li>
    {%- endfor -%}
  </ul>
</nav>
```

This code works as long as URL handles are not translated. If you translate them with Translate & Adapt, Shopify creates redirects from the default language's URLs to the translated URLs; in that case, test each switcher link with `curl -sI` and keep the native form for visitors.

### Drupal

Versions: Drupal 10 and 11, Language Switcher Extended module 1.x.

Enable the Language and Content Translation modules, then place the “Language switcher” block in a region present on every page (`Structure > Block layout`). It produces links to the translation of the current content. To handle untranslated content (hide the language, link to the homepage, or name without a link), the contributed Language Switcher Extended module adds these options.

### Laravel

Versions: Laravel 11 to 13, mcamara/laravel-localization 2.

With the Laravel Localization package (mcamara), `getLocalizedURL()` returns the URL of the current page in another language:

```blade
{{-- resources/views/partials/language-switcher.blade.php --}}
<nav aria-label="{{ __('Choose a language') }}">
    <ul>
        @foreach(LaravelLocalization::getSupportedLocales() as $code => $properties)
            <li>
                <a href="{{ LaravelLocalization::getLocalizedURL($code, null, [], true) }}"
                   hreflang="{{ $code }}"
                   lang="{{ $code }}"
                   @if($code === app()->getLocale()) aria-current="page" @endif>
                    {{ $properties['native'] }}
                </a>
            </li>
        @endforeach
    </ul>
</nav>
```

The last argument forces the default language's prefix when it is hidden, which prevents a cookie or session from redirecting the visitor. For content slugs translated in the database, implement the package's `LocalizedUrlRoutable` interface on the model, or pass the view an array of URLs per language (see [link to the equivalent page rather than the homepage](https://checklist-seo-geo.com/en/international-architecture/link-equivalent-page-rather-than-homepage)). Include the partial in the main layout: `@include('partials.language-switcher')`.

### Next.js

Versions: Next.js 15 and 16, App Router and Pages Router.

#### App Router

Render the switcher in a Server Component: the links are then in the initial HTML. The component receives the equivalent URLs computed by the page:

```tsx
// components/language-switcher.tsx
import Link from 'next/link';

const languages = [
  { code: 'fr', label: 'Français' },
  { code: 'de', label: 'Deutsch' },
  { code: 'en', label: 'English' },
];

type Props = {
  current: string;
  alternates: Record<string, string>;
};

export function LanguageSwitcher({ current, alternates }: Props) {
  return (
    <nav aria-label="Language">
      <ul>
        {languages
          .filter(({ code }) => alternates[code])
          .map(({ code, label }) => (
            <li key={code}>
              <Link href={alternates[code]} hrefLang={code} lang={code} aria-current={code === current ? 'page' : undefined}>
                {label}
              </Link>
            </li>
          ))}
      </ul>
    </nav>
  );
}
```

`next/link` produces an `<a href>` element.

#### Pages Router

With the i18n routing of `next.config.js` and identical paths in every language, `next/link` adds the requested language's prefix itself. Server-rendered or statically generated pages contain these links in their HTML:

```tsx
// components/LanguageSwitcher.tsx
import Link from 'next/link';
import { useRouter } from 'next/router';

const labels: Record<string, string> = { fr: 'Français', de: 'Deutsch', en: 'English' };

export function LanguageSwitcher() {
  const { asPath, locale, locales = [] } = useRouter();

  return (
    <nav aria-label="Language">
      <ul>
        {locales.map((code) => (
          <li key={code}>
            <Link href={asPath} locale={code} hrefLang={code} lang={code} aria-current={code === locale ? 'page' : undefined}>
              {labels[code]}
            </Link>
          </li>
        ))}
      </ul>
    </nav>
  );
}
```

With translated slugs, pass the component the table of equivalent URLs instead, as with the App Router.

### Nuxt

Versions: Nuxt 3 and 4, @nuxtjs/i18n module 10.

With `@nuxtjs/i18n`, declare the languages as objects (`code`, `language`, `name`) in `nuxt.config.ts`, then:

```vue
<!-- components/LanguageSwitcher.vue -->
<script setup lang="ts">
const { locale, locales } = useI18n();
const switchLocalePath = useSwitchLocalePath();
</script>

<template>
  <nav aria-label="Language">
    <ul>
      <li v-for="item in locales" :key="item.code">
        <NuxtLink
          :to="switchLocalePath(item.code)"
          :hreflang="item.language"
          :lang="item.language"
          :aria-current="item.code === locale ? 'page' : undefined"
        >
          {{ item.name }}
        </NuxtLink>
      </li>
    </ul>
  </nav>
</template>
```

Nuxt's server rendering places these links in the initial HTML. For routes with translated slugs, set each language's parameters with `useSetI18nParams`.

### Astro

Versions: Astro 5 to 7.

Astro provides `getRelativeLocaleUrl()` in `astro:i18n`. Example for paths that are identical from one language to another:

```astro
---
// src/components/LanguageSwitcher.astro
import { getRelativeLocaleUrl } from 'astro:i18n';

const labels: Record<string, string> = { fr: 'Français', de: 'Deutsch', en: 'English' };
const current = Astro.currentLocale;
const path = Astro.url.pathname.replace(new RegExp(`^/${current}(?=/|$)`), '').replace(/^\//, '');
---
<nav aria-label="Language">
  <ul>
    {Object.entries(labels).map(([code, label]) => (
      <li>
        <a href={getRelativeLocaleUrl(code, path)} hreflang={code} lang={code} aria-current={code === current ? 'page' : undefined}>{label}</a>
      </li>
    ))}
  </ul>
</nav>
```

With translated slugs, pass the component a table of equivalent URLs rather than recomputing the path.

### Webflow

Versions: Webflow with Localization, November 2026.

The “Locales list” element in Webflow Localization routes to the current page in each published language. Webflow states that this automatic routing only works with links of the page or collection page type, not with a URL typed by hand.

## Common mistakes

- **A `<select>` menu driven by JavaScript**: visually pleasant, invisible as a link to crawlers.
- **`href="#"` links filled in on click**: this is the case with the localization form in Shopify themes.
- **A switcher injected after the page loads** by a third-party script: missing from the initial HTML.
- **Flags without a language name**: a country's flag does not say which language will be served.
- **Language names translated into the current language**: a German speaker looks for “Deutsch”, not “Allemand”.
- **`nofollow` on language links**: you remove the very link you wanted to pass.
- **A switcher missing from the mobile menu**, or present only on the homepage.
- **Links that redirect**: each link must return 200 directly.

## Frequently asked questions

### Can Google crawl a select drop-down menu?

No, a `<select>` drop-down that changes the page in JavaScript is not a link for Google, which can only reliably follow `<a>` elements with an `href` attribute. The other languages can still be discovered through the hreflang annotations and the sitemap, but they do not receive this internal link. To keep a drop-down menu, put real links inside a `<details>` element or a CSS-styled menu.

### Should you use flags in a language switcher?

Avoid flags on their own. The W3C points out that a flag represents a country, not a language: English, Spanish and Arabic are spoken in many countries, and the choice of a flag can offend part of the audience. Write the name of each language in that language, for example Deutsch or Español. A flag can accompany the name when the choice really is about a country.

### Are hreflang tags enough without a language switcher?

For Google, hreflang annotations are enough to link the language versions together and to show the right one in the results. They do nothing for visitors, who need a visible way to change language, nor for crawlers that only read the links in the content. Google recommends adding links to the other language versions on your pages: do both.

### Should language switcher links be nofollow?

No. The switcher's links connect legitimate pages of the same site and help search engines discover each language version. A nofollow attribute asks, on the contrary, that they not be taken into account. Leave them followed, make sure they return 200 without a redirect, and keep nofollow or sponsored for the links you do not want to endorse.

## Resources

- [Google Search Central: Managing multi-regional and multilingual sites](https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites?hl=en)
- [Google Search Central: Make your links crawlable](https://developers.google.com/search/docs/crawling-indexing/links-crawlable?hl=en)
- [W3C: Indicating the language of a link destination](https://www.w3.org/International/questions/qa-link-lang)
- [W3C WAI: Understanding Success Criterion 3.1.2, Language of Parts](https://www.w3.org/WAI/WCAG22/Understanding/language-of-parts.html)
- [Polylang: Function reference](https://polylang.pro/documentation/support/developers/function-reference/)
- [Shopify: shop_locale Liquid object](https://shopify.dev/docs/api/liquid/objects/shop_locale)
- [Nuxt i18n: Language switcher](https://i18n.nuxtjs.org/docs/guide/lang-switcher)
- [Astro: Internationalization](https://docs.astro.build/en/guides/internationalization/)
- [Drupal: Language Switcher Extended](https://www.drupal.org/project/language_switcher_extended)

Next steps: [link to the equivalent page rather than the homepage](https://checklist-seo-geo.com/en/international-architecture/link-equivalent-page-rather-than-homepage), [check the language switcher on every page](https://checklist-seo-geo.com/en/multilingual-linking-schema/check-language-switcher-every-page) and [test keyboard navigation of the language switcher](https://checklist-seo-geo.com/en/development-accessibility-language/test-keyboard-navigation-language-switcher).
