Many websites serve users all around the world with content translated or targeted to users in a certain region. Google uses the
rel="alternate" hreflang="x" attributes to serve the correct language or regional URL in the search results. The hreflang attribute enables a search engine to understand the language and geographical set up of a website.
There are 3 scenarios that can be covered with the hreflang attribute:
If the hreflang attribute is not applied or is applied incorrectly it will mean your target audience will be landing on a page not targeted for them. If you want to improve your visibility in the search engine listing, volume of traffic and bounce rate then use the hreflang attribute carefully.
The hreflang attribute can be implemented in three ways:
<head>section of every page.
The value of the hreflang attribute defines the language of alternate URLs. For language codes use the ‘ISO 639-1‘ standard, for country codes use the ‘ISO 3166-1‘ standard.
If your site only targets different languages, you only need ISO 639-1. If you need distinction between region and language, then you also need ISO 3166-1.