How to fix incorrect hreflang tags in Shopify

Home » Articles » Shopify » How to fix incorrect hreflang tags in Shopify

Incorrect hreflang tags can hurt your Shopify store’s international SEO. But don’t worry, there’s a quick and easy fix.

Simple method to fix the wrong hreflang tags

Here’s how to sort it out:

  • Open your theme.liquid file
  • Then find the line that says {{ content_for_header }}
  • What you need to do is to replace it with this code:
{% comment %}{{ content_for_header }}{% endcomment %}
{{ content_for_header | replace: 'hreflang="es-GB"', 'hreflang="es"' | replace: 'hreflang="de-GB"', 'hreflang="de"' }}

Take note that store owner needs to adjust the language codes to match your store’s needs

Conclusion

This simple change will correct your hreflang tags, ensuring search engines understand your site’s language versions correctly. Remember to double-check your language codes to make sure they’re right for your store.

Wave

Enjoy our articles? Join our free list and get more.

Sign Up

Book Discovery Call