Hreflang is code that you use to tell search engines that the various translated URLs of your site contain the same content, just in different languages. Hreflang tags are the secret ingredient to presenting the appropriate version of your site to a user based on their location and language settings. There are three key rules to hreflang implementation:
1) Valid attributes
The most basic rule: ensure that your hreflang attribute is in ISO 639-1 format, which assigns every language a standardized two letter code. For example:
- English = en
- German (Deutsch) = de
- Chinese (Zhōngwén) = zh
- Urdu (اردو) = ur
If you wish to specify a regional version of a language, such as Canadian French or Austrian German, comply to ISO 3166-1 Alpha 2 format. This is typically where things go wrong, so be sure to consult the linked list.
2) Return links
Every URL needs return links to every other URL and in the case of multilingual websites, these should point to the canonical element (rel=canonical). The canonical element or link of a URL is used by webmasters to prevent duplication and to specify the “preferred” version of a page to improve a site’s SEO.
This means that if you have multilingual versions of the same content, you direct search engines to a single “canonical” version for maximized SEO. It’s similar to a 301 redirect without the actual redirecting.
The more language options your site has, the more you’ll want to cut corners. However, there’s no way around it: if you are working with 30 languages, you’ll have hreflang links for 30 URLs.
Including hreflang links to self makes it clear that a page is a part of a set. Simply put, if you have a “Contact Us” page in 3 languages, all 3 pages need to link to the 2 other versions as well as have a self-referencing hreflang link.