The hreflang tag is like a signpost for search engines, especially Google, to understand that your website is localized for multiple languages. It helps ensure that when people search in different languages, they find the most relevant version of your website.
There are two ways of marking the pages:
- Content in different languages like en, de, or fr.
- Content with regional variations of the same language, like en-us or en-GB.
For example, if you create a Spanish version of your English-language homepage, you would tag it as "Spanish," which inserts hreflang= "es." As a result, the Spanish version of your page opens for the searchers with an IP address in a Spanish-speaking country.
Hreflang can also indicate variants of the same language. For example, for pages targeting Spanish speakers in Mexico, the hreflang tag is set to "es-MX," where "es" indicates Spanish and "MX" represents Mexico.
Google has a best practice guide for using hreflang tags, which you can check out here.
Note: When you add a new language and create a multilingual site, the language code of all pages created in a specific language is updated automatically. However, if you only need a few pages in the other language without making the whole site multilingual, you can change it manually.
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:
- Click Pages on the Topbar to open the Page manager and locate there the page you want to make language-specific.
Click the Page settings icon to access the Page settings menu.
- In the General tab, go to the Language Code section and choose the language you want to add the hreflang tag for from the dropdown list.
- Click Submit and publish your website to make the changes live.
Your language code selection (hreflang tag) appears in the <head> section of the page, as in the picture below.
We hope you find this article helpful. If you have any questions left, please contact our Support Team.
Ready to use your new knowledge? – Edit your site!