Why am I facing hreflang tag issues on my online store?

Why am I facing hreflang tag issues on my online store?

DeskTech
Tourist
4 0 1

I am getting issues with my hreflang tags on my Shopify store, specifically...

  • Broken hreflang URL
  • No self-referencing hreflang

This is what I have tried inside theme.liquid:

 

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
  <meta name="theme-color" content="{{ settings.color_secondary }}">
  
  
  {%- if canonical_url != blank -%}
    <link rel="canonical" href="{{ canonical_url }}">
    <link rel="canonical" href="{{ canonical_url }}" hreflang="en-us">
    <link rel="canonical" href="{{ canonical_url }}" hreflang="en-gb">
  {%- endif -%} 

Can anyone help me out and let me know what I am doing wrong?

 

Here is the issues popping up in SEMrush letting me know that I have hreflang conflicts and what and where they are.

 

Screenshot 2023-07-04 at 09.51.07.pngScreenshot 2023-07-04 at 09.51.31.png

Replies 3 (3)

MaxDesign
Shopify Partner
215 15 92

I suppose you are using Shopify Payments. Unless you have an advanced use case, you should not have to worry about hreflang tag attributes, Shopify automatically adds them in the <head> tag for you based on the available languages and regions used by your store.

You can see on this screen capture there are 5 of them, including the default one:

MaxDesign_0-1688630652710.png


So yours are duplicate, what's more they use a canonical rel attribute instead of the rel alternate attribute. From what I can see, I'd say you shoud most likely remove the code you added and leave it as it was initially, which I suppose are those 2 lines:

<link rel="canonical" href="{{ canonical_url }}" hreflang="en-us">
<link rel="canonical" href="{{ canonical_url }}" hreflang="en-gb">

 

Reach out to me at admin@maxdesign.expert
DeskTech
Tourist
4 0 1

Hey Max, 

 

I took out the two lines. Although, Shopify automatically does this SEMrush and Google are both detecting hreflang errors how can I fix these issues as they directly effect my SEO. 

4cayton
Visitor
1 0 0

I am having the same issue with SEMRush. Were you able to resolve this?