Hreflang Tag in SEO - How To Use

The hreflang tag is used to show content based on the country. If the site language is USA English, you can show the page in the USA only with the help of the hreflang tag. Suppose you have x default value set in the URL for specific language and country then the page will be shown in the default language for the country.

Hreflang tags meaning is to set and show the web page according to the relevant country using its syntax. This is not any redirect but it alternates the URL with the help of language code.

Add hreflang tags in the link of the web page. 

Why put hreflang in the head section of the required web page

To show the web page location-wise, this tag is used. 

Next, understand syntax

Syntax: <link rel="alternate" href="url_of_page" hreflang="lang_code" />

link rel="alternate" meaning

link rel="alternate" used to change page address. Further, in other words, the alternate hreflang tag is instructor to the crawler which page needs to be indexed. 

href="url_of_page" meaning

The link of the web page of the unique language post comes under href="url_of_page" because this is the source of the link that corresponds to the language-based web page. 

hreflang="lang_code" meaning

The language is added into hreflang="lang_code" where the code option is written. 

hreflang="x-default" meaning

hreflang="x-default" is used with pages you want to show if there is no language condition.

Syntax: <link rel="alternate" href="url_of_page" hreflang="x-default" />

Why do we need hreflang

To provide the reader the best experience in the local home country, it is used. Language is decided by the site admin to fill in the hreflang and shows the page in the required language is coded with the rule of the hreflang tag. I have talked about this rule and the syntax that is required to be used in the head section of the page.

This is the way to add code instructions to the head section of the page. Alternate hreflang links are easy to make with the code I described above. Show pages smartly. 

But if you don't use this you need to tell the country in the meta title.

Canonical and hreflang are different from each other and have a separate function to do. 

Google hreflang tags have been used before in the Google search console. Later on, this option disappeared from the GSC.

Moreover, I have told you in starting "href lang x default" is used to instruct the crawler which page link has to be picked by default for all versions of language codes. So add in all web pages based on the default language. 

Talking about href lang SEO. All you need to follow the syntax to implement. 

Note: If you use hreflang code then apply it to all pages otherwise some of the pages can create problems that do not have hreflang code.

Problem by not using it

Google will show web pages in all countries without any condition if the hreflang tag is not declared. If readers see a different language then they quit.

Hreflang with HTTP header

Syntax - Link: <url1>; rel="alternate"; hreflang="lang_code_1",  <url2>; rel="alternate"; hreflang="lang_code_2", ...

Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en",
<https://de-ch.example.com/file.pdf>; rel="alternate"; hreflang="de-ch", <https://de.example.com/file.pdf>; rel="alternate"; hreflang="de"

Hreflang with sitemap

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/english/page.html</loc>
<xhtml:link
rel="alternate"
hreflang="de"
href="https://www.example.de/deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="de-ch"
href="https://www.example.de/schweiz-deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="en"
href="https://www.example.com/english/page.html"/>
</url>
</urlset>

Overall, the hreflang attribute is helpful.

Hreflang helpful tool


How to fix errors?

Check the page manually but it is hard for big sites how to fix them. There is a solution to create a language-based directory for your blog, also set the hreflang rule to show the page. This can be done with an HTTP header. Set language once for the directory.

Contact Form

Name

Email *

Message *

Popular posts from this blog

SEO Website Design - How To Select

SEO Best Practices - Boost Ranking

Blogspot SEO Optimization - How To Do