I have some errors with the hreflang tags
In this article, you’ll learn how to troubleshoot the most common errors related to hreflang tags when using Weglot.
This article is helpful if your website uses a subdirectory or subdomain integration—not JavaScript.
👉 To learn more, see: How does Weglot manage your website's SEO
What are hreflang tags?
Hreflang tags are small pieces of code that tell search engines what language a page is in. They help show the correct language version of your website in search results based on a user’s language or location.
They look like this:
- WordPress + subdirectory: /en/
<link rel="alternate" hreflang="en" href="http://www.example.com/en/"/>
- Subdomain integration: https://en.example.com/
<link rel="alternate" hreflang="en" href="http://en.example.com" />
Common error messages
Here’s how to fix the most frequent issues reported by SEO tools:
No hreflang tags
If no tags appear on your site:
- Go to your Weglot Dashboard → select your project → Setup tab
- Copy the provided hreflang tags and manually insert them into your <head> section (only needed for non-WordPress projects)
Conflict with your own custom hreflang tags
Each page should contain the same set of hreflang tags across all versions.
Example:
<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/" />
These same tags must be present on all pages (/, /fr/, /es/, etc.).
If you manage your own custom hreflang tags, you can contact support@weglot.com so we can disable Weglot’s automatic hreflang tags.
Duplicate hreflang tags
Make sure hreflang tags are not duplicated in your HTML. This can happen if:
- You use another translation app alongside Weglot
- You’re on Shopify and have native Shopify languages published
➡️ To fix this on Shopify:
- Go to Settings > Languages
- Unpublish and delete any native Shopify languages (they’re not related to Weglot)
Canonical issues
Weglot does not add canonical tags, but will automatically update your canonical tag if one is already present in your HTML.
👉 Make sure to:
- Manually add a canonical tag in the original version of your site
- Let Weglot adjust it automatically for translated versions
HTML lang attribute doesn't match
Your <html lang="..."> attribute must match the hreflang values.
❌ Example of mismatch:
<html lang="en-US"> <link rel="alternate" hreflang="en" href="..." />
The "en" hreflang tag added by Weglot does not match with the "en-US" HTML lang attribute of the links it points to.
✅ Solution:
- Update the lang attribute to match, e.g., lang="en"
- You can also use a CMS plugin to edit this attribute if needed.
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
On Squarespace and Webflow, some hreflang-related errors can occur because Weglot cannot modify the original version of your pages.
When using Weglot with a subdomain integration, Weglot can only edit the translated pages. These translated versions will include the correct hreflang tags with the full path of each URL.
👉 However, on the original version of your pages, Weglot cannot automatically insert the full path in the hreflang tags.
To fix this, you can use our integration guide: ➡️ https://github.com/weglot/integration-hooks
This solution allows you to:
- Automatically add hreflang tags to your original pages
- Include the correct relative paths for each translated version
As a result, your original pages will also contain accurate and complete hreflang tags.
Note: This doesn’t prevent Google from indexing your content. Translated pages should still be indexed correctly.
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.