What is Hreflang Attribute?

Hreflang is a special type of HTML link that tells search engines the relationship between pages
in different languages on your website. Google uses it to serve the correct regional or language
URLs in their results are based on which country and language you prefer.

Hreflang tags are a language attribute that helps Google and other search engines understand
where the content is optimized for translation to certain languages. It also helps search engines
understand which pages are duplicates of others, or not relevant in any given language. If done
correctly it can drastically improve your site’s international ranking.

There are two types of hreflang attributes:

If you have country-specific language pages, then you need to use the language attribute.

If your website has multilingual pages in a single language (for instance, English), and each
page is translated into other languages on your site when accessed from different parts of the
world or it is told to.

You can use the hreflang attribute to tell search engines that it is a translated version of another
page or web page.

Below are some template codes you can use for implementing the hreflang in your pages:

<link rel =” alternate ” href =” https://example.com/es/page/” hreflang=”es-sp” />

<link rel=”alternate” href=”https://example.com/zh-cn/” hreflang=”zh-hans” />

<link rel=“alternate” href=“https://example.com/pt-br/page/” hreflang=”es,en” />

Where does the hreflang tag go?

A link can be implemented in one of three ways, from these. The first option is by adding a tag
to the HTML head of your site’s page; it will then appear as an actual blue hyperlink on that
particular web page when clicked upon or hovered over with their cursor. Another way this could
work would be if you insert that same code at the bottom/end-of-file for certain non-HTML files
like PDFs (it doesn’t apply to images). Lastly, links can also function through XML sitemaps
which are generated automatically via Google Webmaster Tools once created & linked up
properly within those settings.

Once Google sees these websites as related, they will then follow the Hreflang instructions to
display what is correct for a particular user depending on their current language settings.

As of 2018/2019, there are more than 40 languages listed within the supported options within
Google’s search engine listings can easily be selected without any effort- just simply
Click.

Some basic know-how before implementing hreflang tag

Many experts believe that Google will not always honor the hreflang annotation. Even if they do,
there is no guarantee of success.

The hreflang attribute does not replace meta language codes.

Websites cannot alter the content based on language settings- users will still see the same
page regardless of their preferred choice of language. However, you can present them in a
particular way for that region’s users (i.e., currency, time format, etc.

If you only state a URL for speakers of a language living in your specified countries but don’t
dictate the appropriate URL for users of that same language living outside those specific areas
(e.g., a Spanish speaker residing in the USA), Google will make its best guess as to which
version should be shown to them. The generic tag hreflang=”es” is helpful if you want all
versions available on the web and not just ones geared towards one region or another; this way
it doesn’t matter where they’re located when accessing your site, they’ll automatically be
redirected appropriately with no additional work required from yourself.

Why should Hreflang Attribute be used?

Solves duplicate content issues; helps in SEO

Hreflang offers a simple solution for those with duplicate content in their sites across multiple
regions. It can be difficult to determine which version of an article is the original, and by
implementing this protocol you are able to pinpoint where it was originally published so your
readers will get the most accurate information possible.

This new technique solves genuine duplication issues quickly and easily when there’s no way to
know what site copy comes first or if they’re both equally valid copies-which happens often on
large websites that have pages targeted toward different countries or languages. You’ll just
need some rel=hreflangs tags at the top of each page indicating how many other versions exist
as well as links pointing back into themselves.

Customer-targeted content; Good user experience

With hreflang, you can give a different experience to different dialects people, imagine a Chinese
the person sitting in the USA drops to a website that has hreflang=”zh-hans” will feel more at
home, and will have a better experience, rather than scrolling through the website in the English
language.

You should also add relevant hreflang tags in the head tags of your internal links if you have a
multi-language website so that search engines can have references and easily understand
where to deliver targeted results.

Try it yourself for more understanding. http://example.com/us/ & http://example.com/uk/

End Thoughts

Hreflang is a tag attribute that helps search engines serve the appropriate version of your
website to international web users. It will be important for you to use the correct language code
and country code everywhere you implement it on your site. This helps you a great deal with
search engine optimization, with little effort at all.