I have some errors with the hreflang tags

In this article, you will learn how to troubleshoot the most common error messages with hreflang tags.


This article is useful if you manage a subdomain or subdirectory integration on your website rather than a JavaScript integration (see How does Weglot manage your website's SEO, for more information).



What are hreflang tags?

As a key part of your SEO (Search Engine Optimization), hreflang tags are snippets of code that tell search engines like Google what language the content on any given page is written in so the search engines can serve that result to users searching in that language.

They look like this:

<link rel="alternate" hreflang="en" href="http://www.example.com/en/"/>

(with WordPress and subdirectory integration) or

<link rel="alternate" hreflang="en" href="http://en.example.com" />

(on subdomain integration).

Common error messages

Here are the most common error messages with hreflang usage:

  • No hreflang tags

If your site doesn't have any hreflang tags, you'll need to copy-paste the hreflang links you will find in your Weglot Dashboard -> Select your project -> Setup page (for non-WordPress projects).

  • Conflict with your own custom hreflang tags

Your original version should have the exact same number of hreflang tags as your translated version(s).

The hreflang tags must be identical in each URL contained in the hreflang tags. For example, if you have three hreflang tags:

<link rel="alternate" hreflang="en" href="http://www.mywebsite.com/" />
<link rel="alternate" hreflang="fr" href="http://www.mywebsite.com/fr/" />
<link rel="alternate" hreflang="es" href="http://www.mywebsite.com/es/" />

The same hreflang tags must be on all these pages.

If you manage your hreflang tags on your side, you can contact Weglot support so we can make sure Weglot's hreflang tags are not added.

  • Duplicate hreflang tags

Ensure the Weglot hreflang links are not added several times in your HTML source code or that you are not using another translation tool on your website besides Weglot.

On Shopify websites, ensure you don't have any registered languages in your Shopify admin > Settings > Store Languages. If so, please unpublish and delete them. They are indeed something different from Weglot, and it can create some conflicts in the code.

  • Canonical issues

Note that Weglot adds the hreflang tags but doesn't add the canonical tag in your HTML code. You must add the canonical tag on your side, as Weglot can't do it.

Weglot will automatically replace the canonical tag with the right one for the current page when the canonical tag is added. This means that if your original page contains a canonical tag, Weglot will automatically handle it to respect the translated URL.


Many scenarios cause canonical issues, but according to Google, here are a few of the most common.

  • HTML lang attribute doesn't match

The issue can be caused by the fact that the value of the HTML "lang" attribute in your original content doesn't match the hreflang tags added by Weglot.

For example, consider an HTML lang attribute set to "en-US" and a hreflang tag:

"<link rel="alternate" href="https://www.mywebsite.com" hreflang="en" />"

The "en" hreflang tag added by Weglot does not match with the "en-US" HTML lang attribute of the links it points to.

Therefore, to solve the issue, you'll need to change the HTML lang attribute value in your original content to "en" instead of "en-US." You may also use a plugin to change this attribute value.

  • Missing x-default

According to Google documentation, the x-default tag has to be added when no language matches.

Some SEO checkers advise adding an x-default tag. However, it is best used on a language selector page where no particular languages match. So, it will need to be represented with the x-default tag.

Otherwise, your original version should have the hreflang tag regarding your original language.

Depending on the CMS you use, you should be able to add the x-default hreflang tag automatically. Alternatively, you may use a plugin or app to do so.

Squarespace and Webflow

Some error messages on Squarespace and Webflow can come from the fact that Weglot cannot edit your original pages by default. When you set up Weglot and the subdomain integration, Weglot can only change the content of the translated pages, and it correctly creates the hreflang tags for all these pages.

In the translated versions, the paths are the correct full paths of the current URL. In the original content, though, Weglot can't access it and add the full path in the hreflang tags.

Thanks to this documentation we created: https://github.com/weglot/integration-hooks, you should be able to automatically manage the addition of alternative URLs with the relative URL of the page on the original version of your site.

With it, you will also have the correct paths in the hreflang tags of your original pages.

This doesn't prevent Google from indexing your website, and the translated pages should be correctly indexed anyway.

Hreflang Checker

It’s a good idea to check that your hreflang tags are working correctly. We’ve developed the Hreflang Checker tool for this very purpose.

Paste the URL you want to check into the search bar and then click the “Test URL” button.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us