Skip to content
LingravelixMultilingual websites, planned properly

Guide

Hreflang explained for multilingual Swiss websites

Hreflang is a set of annotations that tells search engines which pages are language or regional versions of each other, so that a reader in Geneva is offered the French page and a reader in Zurich the German one. It does not translate anything, and Google does not describe it as a ranking signal; it labels alternatives.

What the annotation actually says

An hreflang annotation is a sentence a page makes about its siblings: "this content also exists in French for Switzerland, at this address". Google describes the purpose plainly: the annotations help its search results point people to the most suitable version of a page by language or region 1. Without them, a search engine has to guess from the visible text which version suits which reader, and guesses can go wrong when two versions share a lot of wording, such as German pages for Germany and for Switzerland.

Three things follow from that description. First, hreflang only makes sense when real alternatives exist; a site in one language has nothing to annotate. Second, it works between pages, not between whole sites, so every page carries its own set. Third, it is a hint about which version to show, not a ranking signal, and nothing in Google's guidance says otherwise.

Three places to put it

Google accepts the same information in three forms: link elements in the HTML head of each page, HTTP response headers, or entries in an XML sitemap 1. They are equivalent, so choose by what your platform makes easy to maintain.

  • HTML head. A practical choice for a content management system. Every version prints the full set of link elements.
  • HTTP headers. Useful for files without an HTML head, such as PDF brochures that exist in German and French.
  • Sitemap. Handy for large sites, because the set lives in one generated file instead of in every template.

Mixing methods for the same pages adds nothing and doubles the places where a mistake can hide. Pick one per page type and write it down in your site documentation.

The return-link rule

The rule that is easiest to break is a short one. In Google's documentation, every language version has to name itself and every sibling, and a pair of pages that do not reference one another in both directions has its tags disregarded 1.

In practice this means the German page lists German, French, Italian and English, including its own address. The French page lists exactly the same four entries. If the Italian page was published later and nobody updated the others, the pair is one-sided and that link does not count. This is why hreflang is better generated by the platform from one record of which pages belong together, rather than typed by hand into each page.

Writing the codes correctly

Each value is a language code, optionally followed by a region code. Google specifies the language in ISO 639-1 format, which gives two letters such as de, fr, it, rm for Romansh and en, and the region in ISO 3166-1 alpha-2 format, such as CH, DE, AT or FR 1.

Codes a Swiss site might use
ValueMeaningWhen to use it
deGerman, any regionOne German version for every German reader
de-CHGerman for SwitzerlandA version written for Swiss readers, with CHF prices and Swiss spelling
fr-CHFrench for SwitzerlandFrench content aimed at the Romandie
it-CHItalian for SwitzerlandItalian content aimed at Ticino and the Italian-speaking valleys of Graubünden
rmRomanshContent in Romansh
enEnglish, any regionEnglish content for residents, visitors and partners abroad
x-defaultNo other entry matchesA language chooser page or a chosen fallback

The W3C's advice on language tags in general points the same way: keep a tag as short as possible and add a region subtag only when it carries information you need 2. A Swiss company with one German version gains nothing from de-CH unless it also has a separate version for Germany. The full list of valid subtags lives in the IANA language subtag registry 3.

Two codes deserve a warning. The region code for the United Kingdom is GB; UK is not an officially assigned ISO 3166-1 code. And the region always comes after a language: CH alone is not a valid value, because Switzerland is a country, not a language.

What x-default is for

The reserved value x-default covers readers whose browser settings match none of your listed versions 1. A Portuguese-speaking reader looking at a site with German, French, Italian and English versions matches nothing. If you have a page that lets people pick their language, that page is the natural x-default. If you do not, you can point it at the version you would rather show, such as an English page for an international audience. It is optional, and leaving it out is not an error.

Hreflang is not a language detector

A misunderstanding worth clearing up: Google states that it does not use hreflang or the HTML lang attribute to detect which language a page is in 1. It reads the visible content for that 4. So hreflang cannot rescue a page whose body is half German and half English, and a correct lang attribute does not tell a search engine anything it would not see in the text.

That does not make the lang attribute pointless. Browsers, screen readers and translation tools rely on it, and WCAG 2.2 makes declaring the language of each page a Level A requirement 5. Hreflang is for search engines choosing between pages; lang is for software reading one page.

A worked example

Take a fictional Bernese pasta maker with four versions of its "About us" page: German, French and Italian for Swiss readers, and English for everyone else, plus a language chooser at the domain root. The head of each of the four pages carries the same five lines:

<link rel=alternate hreflang=de-CH href='https://www.example.ch/de/ueber-uns/'>
<link rel=alternate hreflang=fr-CH href='https://www.example.ch/fr/a-propos/'>
<link rel=alternate hreflang=it-CH href='https://www.example.ch/it/chi-siamo/'>
<link rel=alternate hreflang=en href='https://www.example.ch/en/about/'>
<link rel=alternate hreflang=x-default href='https://www.example.ch/'>

The attribute quotes are optional for simple values like these; notice that the addresses are complete, starting with https://, and that each page's own line is included. Translated slugs such as ueber-uns and a-propos are fine; hreflang links pages by address, not by matching file names.

Mistakes that make tags ignored

  • One-sided pairs. A new language added to some pages but not listed on the others.
  • Pointing at redirects or missing pages. The annotated address should answer directly, without a redirect and without an error.
  • Canonical tags that cross languages. If the French page declares the German page as its canonical, it is telling search engines it is a duplicate. Each version should be canonical to itself.
  • Region without language. Values like CH or ch-de in the wrong order.
  • Annotating pages that are not alternatives. A French news article with no German counterpart should not point at the German home page.

The hreflang planner on this site builds a complete set from your versions and flags several of these errors before you publish.

How to check what you have

Open the source of two versions of the same page and compare the hreflang blocks line by line; they should match exactly. Then repeat for a page deep in the site, not only the home page, because templates for articles, products and landing pages can be written separately. Finally, compare the list with your XML sitemap if it also carries annotations, so the two never disagree.

Sources

  1. Localized versions of a page (hreflang) Google Search Central, primary source
  2. Which language tag is right for me? W3C Internationalization Activity, primary source
  3. Language subtag registry Internet Assigned Numbers Authority, primary source
  4. Multi-regional and multilingual sites Google Search Central, primary source
  5. WCAG 2.2 explainer for 3.1.1 (page language) W3C WAI, primary source

Unsure about the tags on your site?

Send us the address. You'll get a short email saying whether we can help.

Ask about hreflang