What Is the Hreflang Tag and How Do You Use It?

What Is the Hreflang Tag and How Do You Use It?

Hreflang is an HTML attribute that tells search engines which language and region a page is written for, and where the same content lives in other languages. Set up correctly, a shopper searching from Germany sees your German page and a shopper searching from Turkey sees your Turkish page.

If your site is in one language only, you don’t need hreflang. If you sell in several languages or countries, it matters, and if you run Shopify Markets or a separate clone store, you should check that your tags actually work. This guide covers what hreflang does, how the codes are written, the most common mistakes and how it works on Shopify.

What Is the Hreflang Tag?

Hreflang is a short set of lines in a page’s source code that say “these are the other language versions of this content”. You don’t have to look far for an example. The source code of the page you are reading right now contains these three lines:

<link rel="alternate" hreflang="tr-TR" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />
<link rel="alternate" hreflang="en" href="https://bytedigital.com/en/blog/how-to-use-the-hreflang-tag-what-does-it-do" />
<link rel="alternate" hreflang="x-default" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />
<link rel="alternate" hreflang="tr-TR" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />
<link rel="alternate" hreflang="en" href="https://bytedigital.com/en/blog/how-to-use-the-hreflang-tag-what-does-it-do" />
<link rel="alternate" hreflang="x-default" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />
<link rel="alternate" hreflang="tr-TR" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />
<link rel="alternate" hreflang="en" href="https://bytedigital.com/en/blog/how-to-use-the-hreflang-tag-what-does-it-do" />
<link rel="alternate" hreflang="x-default" href="https://bytedigital.com/blog/hreflang-etiketi-nasil-kullanilir-ne-ise-yarar" />

The first line says this page is for Turkish readers in Turkey, the second gives the address of the English version, and the third says which page to show when no language matches. That last value is called x-default.

How Does Hreflang Help SEO?

Hreflang’s main job is to show the right version to the right person. A shopper in the UK who lands on a US page priced in dollars will most likely leave without adding anything to the cart. When the right version appears, click-through and conversion rates follow.

The second benefit is that similar pages in the same language stop competing with each other. If the US and UK versions of your English site carry almost identical text, Google has to guess which one to show where unless hreflang tells it. The common claim that you’ll get a duplicate content penalty without hreflang isn’t true, though. Google doesn’t penalise translated or regional versions. The real problem isn’t a penalty, it’s the wrong page showing up in the wrong country.

One more thing to be clear about: hreflang won’t raise your rankings on its own. It makes sure the rankings you already have point to the right language version.

How Are Hreflang Codes Written?

A hreflang value is made of a language code and an optional region code. The language code follows ISO 639-1 (tr, en, de), the region code follows ISO 3166-1 alpha-2 (TR, GB, DE), and the two are joined with a hyphen. A region code can’t be used on its own, so “GB” is invalid while “en-GB” and “en” are valid.

Value

Meaning

When to use it

tr

Turkish readers in any country

You have a single Turkish version

tr-TR

Turkish readers in Turkey

Your Turkish version is specific to the Turkish market

en

English readers in any country

You have one general English version

en-GB

English readers in the UK

Prices, shipping or currency are specific to the UK

de-DE

German readers in Germany

You have a separate version for Germany

x-default

The page to show when nothing matches

For a default version or a language selector page

The code mistake we see most often is “en-UK” for the United Kingdom. The ISO code for the UK is GB, so the correct value is “en-GB”.

3 Ways to Add Hreflang to Your Site

1. In the HTML head

This is the most common method. Each page’s <head> gets a set of lines listing every language version, including the page itself:

<link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
<link rel="alternate" hreflang="de-DE" href="https://example.com/de/produkte/ledertasche" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />
<link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
<link rel="alternate" hreflang="de-DE" href="https://example.com/de/produkte/ledertasche" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />
<link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
<link rel="alternate" hreflang="de-DE" href="https://example.com/de/produkte/ledertasche" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />

2. In the XML sitemap

As the number of languages grows, the head gets crowded. Putting the same information in your sitemap is tidier at that point. Each URL entry lists its alternate versions underneath:

<url>
  <loc>https://example.com/urun/deri-canta</loc>
  <xhtml:link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
  <xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />

<url>
  <loc>https://example.com/urun/deri-canta</loc>
  <xhtml:link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
  <xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />

<url>
  <loc>https://example.com/urun/deri-canta</loc>
  <xhtml:link rel="alternate" hreflang="tr-TR" href="https://example.com/urun/deri-canta" />
  <xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/products/leather-bag" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en-gb/products/leather-bag" />

3. In the HTTP header

Files that aren’t HTML, such as PDFs, have no head section, so the information goes in the server response header instead:

Link: <https://example.com/katalog.pdf>; rel="alternate"; hreflang="tr",
      <https://example.com/catalogue-en.pdf>; rel="alternate"; hreflang="en"
Link: <https://example.com/katalog.pdf>; rel="alternate"; hreflang="tr",
      <https://example.com/catalogue-en.pdf>; rel="alternate"; hreflang="en"
Link: <https://example.com/katalog.pdf>; rel="alternate"; hreflang="tr",
      <https://example.com/catalogue-en.pdf>; rel="alternate"; hreflang="en"

Pick one of the three methods and stick with it. If the head and the sitemap give different information for the same page, Google can’t tell which one to trust.

What to Watch for When Setting Up Hreflang

  1. Tags must be reciprocal. If the Turkish page points to the English page, the English page has to point back. Tags without a return link are ignored.

  2. Every page should list itself. The tags on the Turkish page should include the Turkish page’s own URL.

  3. URLs must be absolute and match the canonical. The URL in hreflang should be that page’s canonical URL. Pointing the English page’s canonical to the Turkish page will drop the English version from the index.

  4. Target pages must return 200. Pointing hreflang at a redirect, a 404 or a noindex page invalidates the tag.

  5. Avoid automatic language redirects. Forcing visitors to another version based on their IP address also stops Googlebot from seeing your other versions. Show a language or country suggestion on the page instead.

  6. Don’t forget x-default. Decide which page a visitor from an unlisted language should see.

How to Set Up Hreflang on Shopify

A single store with Shopify Markets

When you set up subfolders (for example /en-gb) or separate domains for different countries with Shopify Markets, Shopify adds the hreflang tags to your theme’s head automatically. Translations are handled with Shopify’s Translate & Adapt app or a third-party translation app. The one thing to check is that your theme doesn’t still contain hreflang lines added by hand in the past. Combined with Shopify’s automatic tags, they create conflicting and duplicated annotations.

Clone stores, or separate Shopify stores

Some Turkish brands run their international sales on a separate store because Shopify Payments isn’t available in Turkey. We explain the reasons in our guide to setting up a clone store for international sales. In this setup the two stores don’t know about each other, so no hreflang tags are generated. If product URLs differ between the stores, you need a mapping table, and the tags are added through theme code or an app. The same applies to Shopify Plus expansion stores.

A number from the field

Of the 100 Turkish Shopify stores we analysed in October 2026, 38 were published in more than one language. Hreflang was set up correctly on 32 of them and was missing or broken on 6. The rest of the findings are in our technical study of 100 Shopify stores.

How to Check for Hreflang Errors

Google Search Console’s International Targeting report was retired in 2022. These are the ways to check today:

  • Open the page source and search for “hreflang”. It’s the quickest check for a single page.

  • Use the URL Inspection tool in Search Console to see which canonical Google has chosen for the page. If you haven’t set it up yet, our Google Search Console setup guide will help.

  • Crawl the whole site with a tool like Screaming Frog, Sitebulb or SE Ranking. Missing return links, invalid codes and redirected targets are listed in one place.

  • Check the status codes of your target pages. A URL returning 301 or 404 invalidates the tag. We explain what each code means in our article on HTTP status codes.

Frequently Asked Questions

Does hreflang improve rankings?

Not directly. It makes sure your existing visibility goes to the right language version in the right country. The indirect benefit is better click-through and conversion when users land on a page in their own language.

Does a single-language site need hreflang?

No. Hreflang only makes sense when the same content exists in more than one language or regional version.

Can hreflang and canonical be used together?

Yes, and they should be. Each language version should set itself as canonical, while hreflang lists the other versions.

Does Shopify add hreflang tags automatically?

Yes, if you run a single store with Shopify Markets. No, if you use separate stores, in which case the tags have to be set up separately. If you’re new to Shopify, start with our guide to what Shopify is.

Support for Your Multilingual Store

Setting up and auditing hreflang on multilingual Shopify stores is a standard part of our SEO and GEO work. If you’d like to check together whether your language versions are paired correctly, get in touch through our SEO and GEO consulting page.

Keep Reading

Keep Reading

Check out our other articles that might interest you

Let’s Take the Next Step Together

Take the right step now to take your Shopify store to the next level.

Let’s Take the Next Step Together

Take the right step now to take your Shopify store to the next level.

Let’s Take the Next Step Together

Take the right step now to take your Shopify store to the next level.

Newsletter

Subscribe to our newsletter so you don't miss out on the latest industry trends and special offers.

By signing up, you agree to our Privacy Policy.

Byte © All rights reserved

English