
Implementation hreflang simplified: technical SEO guide for multilingual websites
Simplified hreflang implementation: SEO technical guide for multilingual sites
The hreflang tags are essential to indicate to search engines the language and region targeted by your web pages. Correct configuration can avoid duplicate content issues and improve visibility in local results. However, 67% of implementations contain errors, which can harm your SEO.
Key points to remember:
-
Why hreflang?
Direct users to the appropriate language version (e.g., "adidas.com" for the USA, "adidas.fr" for France). -
Recommended structure for Switzerland:
- Use URLs with
/fr/
and/en/
. - Set up tags for
fr-CH
(French, Switzerland) anden-CH
(English, Switzerland).
- Use URLs with
-
Implementation methods:
- HTML Head: Insert tags in
<head>
. - HTTP Headers: For non-HTML files like PDFs.
- XML Sitemap: For large sites.
- HTML Head: Insert tags in
-
Common errors to avoid:
- Missing reciprocal links between pages.
- Incorrect regional codes (e.g., use
fr-CH
, not justfr
). - Non-absolute URLs or misplaced tags.
Practical example:
<link rel="alternate" hreflang="fr-CH" href="https://www.example.ch/fr/page.html" />
<link rel="alternate" hreflang="en-CH" href="https://www.example.ch/en/page.html" />
<link rel="alternate" hreflang="x-default" href="https://www.example.ch/" />
Comparison of implementation methods:
Method | Advantages | Use Cases |
---|---|---|
HTML Head | Easy to configure | Small multilingual sites |
HTTP Headers | Works with PDF files | Non-HTML files |
XML Sitemap | Flexible for large sites | Sites with many pages |
To optimize your hreflang tags, use tools like Screaming Frog and Google Search Console to detect and correct errors. Careful implementation can increase your organic traffic by 20% to 300% in targeted regions.
How to add, test and validate Hreflang Tags: An Hreflang Implementation Guide for Success
Basic structure of hreflang tags
Let's delve into the technical details to ensure correct configuration. Hreflang tags allow search engines to easily recognize the different language versions of your pages.
Components of hreflang tags
Each hreflang tag is based on three key elements:
Component | Description | Example |
---|---|---|
Language Code | ISO 639-1 code (2 letters) | fr, en, de |
Region Code | ISO 3166-1 Alpha 2 code | CH, FR, DE |
Absolute URL | Complete link to the page | https://www.example.ch/fr/ |
Here's a practical example for a multilingual Swiss site:
<head>
<link rel="alternate" hreflang="fr-CH" href="https://www.example.ch/fr/page.html" />
<link rel="alternate" hreflang="en-CH" href="https://www.example.ch/en/page.html" />
<link rel="alternate" hreflang="x-default" href="https://www.example.ch/" />
</head>
Language and region parameters
Let's now analyze specific parameters for a site targeting the Swiss market:
Configuration | Usage | Example URL |
---|---|---|
fr-CH | French version for Switzerland | example.ch/fr/ |
en-CH | English version for Switzerland | example.ch/en/ |
x-default | Default version | example.ch/ |
A few essential technical points to keep in mind:
- Use absolute URLs: always include the complete protocol (https://).
- Place tags in the
<head>
section of the HTML document. - Reference all language variants on each page.
- Ensure bidirectional relationship: if page A points to B, then B must also point to A.
In April 2025, Moz updated its recommendations on hreflang tag implementation. This update highlighted the importance of a rigorous structure to enhance visibility in local search results, emphasizing the correct use of regional codes for multilingual markets like Switzerland.
3 methods to add hreflang tags
To optimize your presence in multilingual search results in Switzerland, you have several options to implement hreflang tags.
Note: It is crucial to use absolute URLs and ensure that each page references all available language versions.
HTML Head Method
Add hreflang tags directly in the <head>
section of each HTML page:
<head>
<link rel="alternate" hreflang="fr-CH" href="https://www.example.ch/fr/page.html" />
<link rel="alternate" hreflang="en-CH" href="https://www.example.ch/en/page.html" />
<link rel="alternate" hreflang="x-default" href="https://www.example.ch/" />
</head>
Key points:
- Make sure to include only tags corresponding to actually available language versions.
HTTP Headers for PDFs
For non-HTML files, like PDFs, configure hreflang tags in the HTTP headers of your server:
Link: <https://example.ch/fr/document.pdf>; rel="alternate"; hreflang="fr-CH",
<https://example.ch/en/document.pdf>; rel="alternate"; hreflang="en-CH"
Attention: This method may lead to a slight increase in server load.
XML Sitemap Method
For sites with a large number of pages, the XML sitemap is a more suitable and scalable option.
<url>
<loc>https://www.example.ch/fr/page.html</loc>
<xhtml:link rel="alternate" hreflang="fr-CH"
href="https://www.example.ch/fr/page.html"/>
<xhtml:link rel="alternate" hreflang="en-CH"
href="https://www.example.ch/en/page.html"/>
<xhtml:link rel="alternate" hreflang="x-default"
href="https://www.example.ch/"/>
</url>
"This is one of the most complex aspects of SEO."
Technical requirements:
- Use UTF-8 encoding.
- Limit the size of the sitemap file to 50 MB or 50,000 URLs.
- Submit your sitemap via Google Search Console.
- Regularly check its status to avoid errors.
Comparison of methods
Here is an overview of the advantages of each method and their use cases:
Method | Advantages | Use Cases |
---|---|---|
HTML Head | Easy to configure | Sites with few languages |
HTTP Headers | Works with PDF files | Non-HTML files |
XML Sitemap | Flexible and suitable for large sites | Sites with many pages |
Correcting common hreflang errors
Now that you know how to add hreflang tags, it's time to focus on common mistakes that can hinder their effectiveness. Correct implementation is not enough: resolving these issues is essential to optimize your SEO.
Missing reciprocal links
A major issue: the absence of bidirectional links. If page A points to page B, it is imperative that page B also points back to page A.
Why it's important? Without these reciprocal links, Google may not consider your hreflang tags. Correct implementation can have a significant impact, increasing impressions and organic traffic by 20% to 300% in targeted regions.
To avoid this error, use tools like Screaming Frog to check that each URL returns a 200 status code and that hreflang tags are reciprocal between pages.
x-default implementation guide
Here is an example of correct implementation with the x-default attribute:
<link rel="alternate" href="https://www.example.ch/" hreflang="x-default" />
<link rel="alternate" href="https://www.example.ch/fr/" hreflang="fr-CH" />
<link rel="alternate" href="https://www.example.ch/de/" hreflang="de-CH" />
"The new hreflang x-default attribute value indicates to our algorithms that this page does not target any specific language or region and serves as the default page when no other page is a better fit." - Pierre Far, Webmaster Trends Analyst
Regional code errors
For a market like Switzerland, the accuracy of regional codes is essential. Misuse can lead to display or relevance issues.
Correct codes for Switzerland:
- fr-CH: French (Switzerland)
- de-CH: German (Switzerland)
- it-CH: Italian (Switzerland)
- en-CH: English (Switzerland)
Points to remember:
- Follow ISO 639-1 (language) and ISO 3166-1 Alpha 2 (region) standards.
- Avoid generic codes like "fr" without specifying a specific region.
- Regularly check your hreflang tags with Google Search Console to ensure they are correctly configured.
A concrete example: The Coca-Cola Company uses hreflang tags to tailor its content to local needs, allowing Swiss visitors to access the version corresponding to their language directly.
Testing hreflang tags for the Swiss market
For effective management of hreflang tags in Switzerland, here are some tools and methods to verify if your configuration is correctly set up.
Verification with Screaming Frog
Screaming Frog is an excellent tool to audit your hreflang tags. Here's how to proceed:
-
Initial setup
Ensure that hreflang tag analysis is enabled inConfig > Spider > Crawl > Hreflang
. If you use XML sitemaps, also enable their crawling inConfig > Spider > Crawl
. -
Results analysis
Go to the "Hreflang" tab to review the detected annotations. Here are some points to check:Code Usage Validation fr-ch French content Check that the code is in lowercase de-ch German content Ensure reciprocal links work it-ch Italian content Confirm link reciprocity en-ch English content Also verify reciprocity x-default Default page Confirm this page is properly configured
Once this step is completed, complement the validation using Google Search Console.
Checks in Google Search Console
Google Search Console (GSC) offers specific tools to detect and correct hreflang errors. Here are the key steps:
- Access the "International Targeting" section.
- Review the hreflang errors report.
- Identify problematic URLs.
- Make necessary corrections.
- Request a new analysis to confirm the changes.