The hreflang attribute (commonly referred to as rel=”alternate” hreflang=”x”) helps search engines understand which language you are using on a specific page, so that they can serve the correct language or regional URL in search results. This article outlines the importance of this tag especially if you have multilingual websites.
When should you use them?
It is recommended in the following scenarios:
- You keep the main content in a single language and translate only the template, such as the navigation and footer. Pages that feature user-generated content.
- Your content has small regional variations with similar content in a single language. For example, you might have English-language content targeted to the CA, MX, and Japan.
- Your site content is fully translated. For example, you have both Korean and English versions of each page.
How and where to add them?
The hreflang attributes can be added under
- Page level in the section
- HTTP Header
Let’s consider we have a site which is configured in multiple languages. This is how the hreflang set up will look like in thesection
The last attribute x-default is more like a fallback version if Google cannot find the suitable match based on the user’s browser language and region.
- It will help search engines more likely to show the right-localized content version
- It helps in preventing duplicate content issues in case of multilingual websites
For more information, read the official google documentation here.