If your website contains content that is available in multiple languages, you may want to let Google know.
Let's say you have a page which is available in three languages: English, French and Mandarin Chinese.
You would first look up the correct language codes for those languages (see below) and then, in your page <head>
, add these tags:
<link rel="alternate" hreflang="en-USβ href="https://mywebsite.com" />
<link rel="alternate" hreflang="frβ href="https://mywebsite.com/fr" />
<link rel="alternate" hreflang="zh-Hansβ href="https://mywebsite.com/cn" />
Language code formats
But how do you know the right language codes to put in the hreflang attribute? According to Google's SEO docs there are three valid formats:
- Language code. Example:
zh
is Chinese - Language with a region. Example:
zh-TW
is Chinese as spoken in Taiwan - Language and script codes. Example:
zh-Hant
is Traditional Chinese
The first option should do just fine for most cases!
Lists of language codes
You can quickly find the language code you're looking for on Wikipedia.
That's it!
Top comments (0)