LEYUN · SITE SPEC & COMPONENT LIBRARY独立站技术规范手册

Language Switcher Component and SEO Adaptation for Independent Sites

Section:B2B COMPONENT SPEC · Reviewed:2026-11-20 · Template asset

Key takeawayThis section defines the structure template, field dictionary, integration points and compliance boundaries for 「Language Switcher Component and SEO Adaptation for Independent Sites」 in B2B COMPONENT SPEC. Templates are for reference only; verify local regulations and platform rules before launch.

Industries and use cases

  • Sites selling the same product to multiple countries in multiple language versions
  • European-market sites combining English with non-English languages
  • Sites that display different price units and certification information per region
  • Sites whose language versions surface for each other's queries in search results
Template / code snippethtml
<nav class="lang-switch" aria-label="语言切换">
  <ul>
    <li><a href="/en/p/model-a/" hreflang="en" lang="en">English</a></li>
    <li><a href="/de/p/model-a/" hreflang="de" lang="de">Deutsch</a></li>
    <li><a href="/fr/p/model-a/" hreflang="fr" lang="fr">Français</a></li>
  </ul>
</nav>

<!-- 每页 head 内的语言声明:双向互指 -->
<link rel="alternate" hreflang="en" href="https://example.com/en/p/model-a/">
<link rel="alternate" hreflang="de" href="https://example.com/de/p/model-a/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/p/model-a/">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/p/model-a/">

<!-- 每页同时声明自身语言与规范地址 -->
<link rel="canonical" href="https://example.com/de/p/model-a/">
<html lang="de">
Fields and parameters
Field / parameterTypeDescription and values
Language codeBCP 47Such as en, de-DE, zh-Hans; casing and separators uniform site-wide
Switch link hreflangAttributePoints to the equivalent address of this page in the other language
x-defaultAttributePoints to the default-language version or a language selection page
canonicalAttributePoints to the page's own address; each language version self-references
html langAttributeMatches the actual language of that version
Switcher entry countNumberNo more than 6 is advised; more disperses attention

SEO and structured-data notes

SEO and structured-data checkpoints
hreflang must be reciprocalWhen A points to B, B must also point to A; without closure the whole group is invalid
Each language version self-references its canonicalDo not merge languages into one with canonical; that serves a different scenario
Keep language code casing uniformde-DE and de-de denote different regions; mixing them invalidates the markup
Keep the switcher in the HTML sourceA JS-rendered switcher may be invisible to crawlers, so the reciprocal relations disappear entirely
Carry the lang attributeScreen readers and search engines both rely on it to determine the actual language
Use native language namesLabel the entry "Deutsch", not "German"; users recognize their own language's name

Compliance risk notes

  • Inconsistent content across language versions confuses users; keep key information synchronized
  • Claims and certification statements must be consistent across versions, or a site ends up compliant in one country and violating in another
  • Poor translation quality directly lowers inquiry quality in a B2B context
  • Do not publish machine-translated content involving parameters and commitments directly
  • Language switching must not cause canonical addresses to point to non-existent pages

Do not reuse this template verbatim in regulated contexts; verify local regulations and platform rules before going live.

Modification example

<!-- Modification example: mark the current language in the switcher -->
<nav class="lang-switch" aria-label="Language switch">
  <ul>
    <li><a href="/en/p/model-a/" hreflang="en" lang="en">English</a></li>
    <!-- Current language: marked with aria-current, no link -->
    <li aria-current="page">
      <span lang="de" aria-label="Current language: Deutsch">Deutsch</span>
    </li>
    <li><a href="/fr/p/model-a/" hreflang="fr" lang="fr">Français</a></li>
  </ul>
</nav>

<!-- Improvements:
     1. The current language is not a link, avoiding redundant clicks
     2. aria-current lets assistive technology and parsers recognize it
     3. Language names use their native form
     4. hreflang and lang are preserved so the reciprocal relations
        are not broken by JS -->

FAQ

Does a language switcher affect SEO?
The switcher itself does not, but misconfigured hreflang directly causes language versions to surface for each other's queries. It is the most common and most overlooked problem on multilingual sites.
Where should x-default point?
To the default-language version, or to a language selection page. The key is that the address must always be reachable.
Can we auto-redirect by region?
Redirection is possible, but do not force it or lock versions with cookies. Forced redirects make it hard for crawlers to reach every language version.
Should every language be built?
Start with languages that have real orders. Rolling out ten languages for coverage raises maintenance cost and quality risk together.
Version notes2026-11-20: first release, compiled from official Google documentation and public technical sources; updated as engine rules change. Engine behaviour details follow the latest official Google documentation.

Note: this page is a summary of publicly documented search-engine rules and is for self-check reference only. Engine behaviour is subject to the latest official Google documentation; verify against your own Search Console data.