The hreflang attribute is used to indicate the language and intended geographical audience of a web page. It helps search engines understand which version of a page to serve to users in different countries or regions, as well as to users searching in different languages.
For example, if a website has versions of a page in English, French, and Spanish, the hreflang attribute can be used to indicate which version of the page should be served to users in France, Canada, and Spain, respectively.
The hreflang attribute can be added to a page in the HTML head or in HTTP header. It’s important to use the hreflang attribute correctly, as it can impact the visibility of your pages in search engines and affect the user experience for visitors from different countries or regions.
Here’s an example of how the hreflang attribute could be used in the HTML head of a page:
<link rel="alternate" hreflang="en-us" href="http://www.example.com/en-us/" />
<link rel="alternate" hreflang="en-gb" href="http://www.example.com/en-gb/" />
<link rel="alternate" hreflang="fr-fr" href="http://www.example.com/fr-fr/" />
In this example, the hreflang attribute is used to indicate that there are three different versions of the page, one in US English, one in UK English, and one in French, and to specify the URL for each version.
It’s also possible to use the hreflang attribute in the HTTP header, like this:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Link:
<http://www.example.com/en-us/>; rel="alternate"; hreflang="en-us",
<http://www.example.com/en-gb/>; rel="alternate"; hreflang="en-gb",
<http://www.example.com/fr-fr/>; rel="alternate"; hreflang="fr-fr"
Using the hreflang attribute correctly can help ensure that your pages are being served to the right audience, in the right language, and can improve the overall visibility and performance of your website in search engines.
List of hreflang country & language combinations
Here is a list of hreflang country and language combinations for the world’s economically strongest markets and strongest EU markets:
- en-us: English (United States)
- en-gb: English (United Kingdom)
- de-de: German (Germany)
- fr-fr: French (France)
- es-es: Spanish (Spain)
- ca-es: Catalan (Spain)
- it-it: Italian (Italy)
- nl-nl: Dutch (Netherlands)
- pl-pl: Polish (Poland)
- pt-pt: Portuguese (Portugal)
- en-ie: English (Ireland)
- da-dk: Danish (Denmark)
- sv-se: Swedish (Sweden)
- no-no: Norwegian (Norway)
- zh-cn: Chinese (China)
- ja-jp: Japanese (Japan)
- ko-kr: Korean (South Korea)
- ru-ru: Russian (Russia)
- en-au: English (Australia)
- en-ca: English (Canada)
- fr-ca: French (Canada)
- de-at: German (Austria)
- fr-be: French (Belgium)
- nl-be: Dutch (Belgium)
- de-ch: German (Switzerland)
- fr-ch: French (Switzerland)
- it-ch: Italian (Switzerland)