When you publish a multi-language website, you will want to make sure people are seeing the correct pages for their location.
Hreflang tags are small elements in your page source code used to tell search engines about pages that are similar in content but targeting different languages. The hreflang attribute (also referred to as rel="alternate" hreflang="x") tells search engines bots which language you are using on a specific page.
There are two ways of marking such pages:
- Content with regional variations like en-us and en-gb.
- Content in different languages like en, de, or fr.
For example, if you create a German-language version of your English-language homepage, you would tag it as "German" which inserts hreflang= "de". As a result, searchers with an IP address in a German-speaking country are served that page in German instead of English.
Hreflang can also indicate variants of a single language. You can choose the hreflang attribute with annotations that indicate which region the content is in, e.g. German hreflang="de" versus Swiss hreflang="de-ch".
Google has a best practice guide for using hreflang tags, which you can check out here.
How to add a Language code
The Language code adjusts the lang attribute of the <html> tag of the page. Here’s how to implement it:
- Go to the Website > Pages menu and locate which page you would like to make language-specific.
- Click on the “cog” Page settings icon to access the Page settings area.
- Scroll down to the Language code area.
- In the drop-down menu, choose the language you want to add the hreflang tag for.
- Click on your selected language and then click Submit.
- Your Language code selection (hreflang tag) will appear in the <head> section of the page: