We are trying to figure what is the correct hreflang
attributes that should be displayed on our pages. We have 4 languages that we will enable for all our pages: English
, French
, Spanish
, German
. Our site is setup as below.
- All
English
pages will be accessible throughhttps://www.example.com/some-path
- All
French
pages will be accessible throughhttps://fr.example.com/some-path
- All
Spanish
pages will be accessible throughhttps://es.example.com/some-path
- All
German
pages will be accessible throughhttps://de.example.com/some-path
What is the correct format to display the hreflang
attributes so that it is crawled correctly by search engines without taking a hit for SEO?
Here is what we tried.
Option 1
<link rel="alternate" hreflang="en" href="example.com/some-path">
<link rel="alternate" hreflang="es-es" href="example.com/some-path">
<link rel="alternate" hreflang="fr-fr" href="example.com/some-path">
<link rel="alternate" hreflang="fr-ca" href="example.com/some-path">
<link rel="alternate" hreflang="de-de" href="example.com/some-path">
Option 2
<link rel="alternate" hreflang="en" href="https://www.example.com/some-path">
<link rel="alternate" hreflang="es-es" href="https://es.example.com/some-path">
<link rel="alternate" hreflang="fr-fr" href="https://fr.example.com/some-path">
<link rel="alternate" hreflang="fr-ca" href="https://fr.example.com/some-path">
<link rel="alternate" hreflang="de-de" href="https://de.example.com/some-path">
Option 3
<link rel="alternate" hreflang="en" href="www.example.com/some-path">
<link rel="alternate" hreflang="es-es" href="www.example.com/es-es/some-path">
<link rel="alternate" hreflang="fr-fr" href="www.example.com/fr-fr/some-path">
<link rel="alternate" hreflang="fr-ca" href="www.example.com/fr-ca/some-path">
<link rel="alternate" hreflang="de-de" href="www.example.com/de-de/some-path">
The goal we are trying to achieve is we want to follow the Supported language/region codes section from webmasters. At some point we will enable more languages such as French for Belgium
and French for Canada
Do not specify a country code by itself. Google does not automatically derive the language from the country code. You can specify a language code by itself if you want to simplify your labeling. Adding the country code after the language to restrict the page to a specific region. Examples:
be: Belarusian language, independent of region (not Belgium French)
nl-be: Dutch for Belgium
fr-be: French for Belgium