Forgefont

Selling abroad

Hreflang on Shopify explained simply

By the Forgefont team · Published

Hreflang tags tell search engines which language or country each version of a page is for, so a French shopper finds your French URL. On Shopify, you rarely write them yourself: the tags are generated automatically once a market or language has its own domain, subdomain or subfolder.

What does an hreflang tag look like?

It is a line in the <head> of a page that points to one version of that page. A store in English and French carries a set like this on both versions:

The value x-default is the fallback for people whose language matches none of your versions. On Shopify, it points to the URL of your backup-region market.

What does Shopify do for you?

According to Shopify’s international SEO guide:

You can turn the automatic tags off, but Shopify warns that this can hurt your SEO, and you would then have to add your own to the theme.

When will you not get hreflang tags?

Shopify generates them only for markets that have a distinct domain, subdomain or subfolder. If several markets share one URL, there is nothing for a tag to point to. Shopify’s redirection documentation also notes that content adapted on a shared domain is not indexed by search engines, while content on a dedicated domain is.

So the choice that matters is your URL structure. Shopify recommends subfolders for most stores. Note one rule: language-only subfolders such as /fr can exist only on your primary market. Secondary markets combine language and country, as in /fr-ca.

Which codes are valid?

Google’s hreflang documentation requires an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha-2 region code. Shopify picks these for you, but they are worth knowing if you audit your pages or write tags yourself.

ValueValid?Why
deYesGerman, for any country
fr-CAYesFrench, for Canada
en-GBYesEnglish, for the United Kingdom
CANoA country alone is not accepted; a language must come first
en-UKNo effectGoogle says UK has no effect; use GB
en-EUNo effectGoogle says EU has no effect

Three rules behind most hreflang errors

Shopify takes care of these while its automatic tags are on. If you have also added a hand-written tag to your theme, or a tool that writes its own, check that the two do not conflict.

How do you check your tags?

  1. Open a translated product page in your browser and view the page source.
  2. Search for hreflang. You should see one line per version, including the page itself.
  3. Open each URL listed and confirm that it loads in the right language.
  4. Repeat from another version to confirm the links go both ways.
  5. Check that your sitemap has been submitted in Google Search Console. Our Shopify SEO guide explains how this fits in.

What hreflang will not fix

Tags point to pages that must already exist. A language with only half its content translated stays half translated, so finish the job with our guide to translating a Shopify store. Google also advises against automatically redirecting people from one language version to another: give them visible links to switch instead. For the wider setup, read how to sell internationally on Shopify.

Forgefont builds your store in the language you choose, and you can add extra languages from $17, paid once. Hreflang then depends on the markets and languages you set up in Shopify. Configure your store to choose your languages.

Frequently asked questions

Do I need an app for hreflang on Shopify?

Usually not. Shopify generates the tags from your market and language settings, and updates them when those settings change. Keep the automatic tags on unless you have another implementation.

Does Google use hreflang to detect a page’s language?

No. Google says it uses neither hreflang nor the HTML lang attribute to detect a page’s language. Each page should simply be written in one language, content and navigation included.

Is it better to use tags, HTTP headers or a sitemap?

Google treats the three methods as equivalent, and using more than one adds no benefit in Search. On Shopify, the tags and sitemap annotations are generated for you.

Keep reading