Best practices

And what are the common mistakes

1. Best Practices for Implementing Hreflang Tags


a. Use Correct Language and Country Codes

Hreflang tags should follow the ISO 639-1 standard for language codes (e.g., "en" for English, "fr" for French) and the ISO 3166-1 standard for country codes (e.g., "US" for the United States, "CA" for Canada). For example:

<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />

Incorrect ordering, such as "us-en" instead of "en-us," can cause issues in search engines identifying the right content.


b. Ensure Bidirectional (Return) Links

Each alternate page should reference back to the original page. Missing return links can cause hreflang signals to be ignored:

<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="fr-fr" href="https://example.com/fr/" />


c. Implement "x-default" for a General Fallback (optional)

The x-default hreflang tag helps when no specific language version is available:

<link rel="alternate" hreflang="x-default" href="https://example.com/global/" />

d. Avoid Using Hreflang on Noindexed Pages

Hreflang tags should not be used on pages marked with noindex. Search engines ignore such pages, making hreflang ineffective.


e. Regularly Audit Hreflang Implementation

Using tools like Google Search Console, Screaming Frog, or hreflang checker tools helps identify missing return links, incorrect codes, or duplicated tags.



2. Common Hreflang Error Messages


a. No Hreflang Tags

If your site lacks hreflang tags, copy the required links from your website management tool or platform (e.g., Weglot Dashboard).


b. Conflict with Custom Hreflang Tags

Your original and translated pages must have the exact same hreflang tags. 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/" />

These same hreflang tags must appear on all these pages.


c. Duplicate Hreflang Tags

Ensure your hreflang tags are not duplicated in your HTML source code. On Shopify, check Settings > Store Languages and remove extra registered languages if needed.


d. Canonical Issues

Weglot and other translation tools do not automatically add canonical tags. You must manually set the canonical tag on your original page. Weglot will adjust it automatically for translated pages.


e. HTML Lang Attribute Doesn't Match

If the lang attribute in your HTML does not match your hreflang tags, it can cause issues. Example:

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

To resolve this, change the HTML lang attribute to match the hreflang tag (e.g., "en" instead of "en-US").


f. Missing x-default

Google recommends adding an x-default tag when no specific language version matches the user. It is best used for a language selector page.

Keep in mind that this x-default tag is optional and shouldn't have any negative impact regarding the SEO of your website



Following these best practices and avoiding common errors ensures that your website is correctly indexed for international users. 🚀