Table of Contents
The hreflang attribute helps search engines to identify the version of a webpage that matches the language and region of a user, ensuring the correct web page is displayed in the search results. But conflicts can occur if this attribute is used incorrectly, leading to incorrect search results.
This is no longer just an issue for large international projects such as a hotel or airline reservation services – the number of smaller online stores is growing, wanting to expand their target audience by providing multiple language versions. The hreflang attribute can be used to achieve this, as it signals to search engines that a page with translated content is an alternative to the original one, rather than a duplicate, which can negatively affect website ranking. This is especially useful for websites with different regions or different language versions in the same region.
What if there are no hreflang attributes on a website
To ensure that a search engine can recognize alternative web resource pages in different languages, it is necessary to specify hreflang attributes. This allows for the appropriate version of a website with translated content to be found, such as Spanish, rather than a page in the default language. There are different ways to configure language versions, such as in website folders, on subdomains, or on various domains. Mixed implementations of multilingualism are possible, such as language versions placed in subfolders on different domains. It is important to note any potential attribute conflicts and to find ways to avoid them.
There are three different ways to configure language versions:
in website folders (site.com/en and site.com/au);
on subdomains (en.site.com and au.site.com);
on various domains (ensite.com and ausite.com).
Some samples of HrefLang HTML codes:
How to use the hreflang attribute?
With rel=”alternate” hreflang=”x” you can define existing page options. For example, the hreflang attribute indicating the use of English for the United States may look like this:
<link rel="alternate" hreflang="en-us" href="http://mysite.com/en-us/">
The en-us bundle is obtained by specifying a language code in the ISO 639-1 format and adding a region according to the ISO 3166-1 Alpha 2 country code system. This means that the page content is designed for English-speaking users located in the United States. It is not necessary to include a region within hreflang, as this will mean that the page is designed for all English-speaking users in the United States, the United Kingdom, Australia, and other countries.
Each hreflang attribute must include:
links to existing language options of the page;
the protocol http/https in the URL text.
Related: How To Fix Low Text to HTML Ratio
What is the Hreflang=”x-default” value
If the user’s browser language does not match any of the language versions of a website, it is best to direct the user to one of the default languages by using the value hreflang=”x-default”.
link rel="alternate" hreflang="x-default" href="https://www.mysite.com/"
Advantages of setting up a multilingual website
Hreflang helps search engines identify versions of webpages with similar content in different languages and regions. This way, crawlers can distinguish between true duplicates and alternative versions, preventing them from being seen as one and the same. This attribute is particularly useful when dealing with languages that are similar, such as English for the US and Canada. Hreflang tags and attributes enable search engines to recognize the linguistic and geographical structure of a site, so they can determine which version of a page is intended for which audience. This prevents duplicate content from negatively impacting a website’s ranking.