Many people when first come to Google Webmaster and try to improve the search presence of their site Console has encountered the following error:
Your site has no hreflang tags. Google uses hreflang tags to match the user's language preference to the right variation of your pages.
Then the very next question they would ask is why this error and how to get rid of it?
Why use hreflang Tag
First thing first, to correct the misconception of that message, I want to point out that the
hreflang is an attribute of the
<meta> HTML tag. So it's NOT really a HTML tag rather a
<meta> tag with this attribute.
The purpose of this hreflang "tag" is used to help Google crawler to identify other versions with different languages of a webpage. So for example you have a webpage that with the following URL:
But you also offer other version of this article in other language say Spanish:
Then in each of those page, sending a signal to Google Crawler that those two pages are related to each other. Basically they have the same content but in different languages. So in two pages you simply put this hreflang "tag" inside the
<link rel="alternate" hreflang="en" href="https://www.beginnertutorials.net/Redirect-to-Previous-Page-In-PHP-Most-Common-Mistake " /> <link rel="alternate" hreflang="es" href="https://www.beginnertutorials.net/es/Redirect-to-Previous-Page-In-PHP-Most-Common-Mistake " />
If a webpage available in more than two languages just use every hreflang tag corresponding to each page.
What About Single Language Site
But what if your site is a single language site and not multi-language site, how to use the hreflang "tag"? That's a good question. Here's come to the answer:
Do not use hreflang at all
The reason not to use hreflang for single language site is because this "tag" is not intended for this kind situation. This tag should be used for multi-language site only. If you continue seeing this error in your Webmaster console, simple ignore it!