What's your biggest current challenge? Have your say in Community Polls along the right column.

Canoncalised URLs

Canoncalised URLs

SHDistill
Tourist
6 0 0

I recently used the SEO tool Screaming Frog and it's flagged an issue with my product pages having canonicalised URLs. I've done some googling but I'm not exactly sure how to fix this issue? I've seen that I need to refer the product link variation back to the original product, but it's still confusing for me. 

 

I checked my code and the only element I can see referring to a canonical link is this "{%- if canonical_url != blank -%} <link rel="canonical" href="{{ canonical_url }}"> {%- endif -%}"

 

This does't look correct to me as there isn't a URL put in place? It looks like this code isn't doing anything at the moment.

 

SHDistill_0-1730191847299.png

 

Any help would be appreciated, thanks!

Reply 1 (1)

PageFly-Amelia
Shopify Partner
626 165 237

Hi @SHDistill ,

This is Amelia from PageFly - a Landing Page Builder App,

It sounds like you’re on the right track with identifying the issue. The rel="canonical" tag is crucial for SEO as it helps search engines understand which URL is the preferred version when there are multiple pages with similar content.

From the code snippet you provided, it seems like the canonical_url variable is not being set correctly, which is why the <link rel="canonical" href="{{ canonical_url }}"> tag isn’t functioning as expected. Here are some steps to help you resolve this issue:

  1. Check the Source of canonical_url: Ensure that the canonical_url variable is being correctly assigned a value. This might be done in your template logic or a configuration file. It should point to the preferred URL of the product page.

  2. Set a Default Canonical URL: If canonical_url is not set, you can provide a default value. For example:

    {%- assign canonical_url = canonical_url | default: page.url -%}
    <link rel="canonical" href="{{ canonical_url }}">
  3. Hardcode the Canonical URL: If your product pages have a consistent URL structure, you might consider hardcoding the canonical URL for each product. For example:

    <link rel="canonical" href="{{ shop.url }}/products/{{ product.handle }}">
  4. Use Shopify’s Built-in Canonical Tag: Shopify automatically generates canonical tags for product pages. Ensure that you are not overriding this functionality unless necessary. You can check Shopify’s documentation for more details on how they handle canonical tags.

  5. Verify with Screaming Frog: After making these changes, re-crawl your site with Screaming Frog to ensure that the canonical tags are correctly implemented.

  6. Consult Shopify’s SEO Guide: Shopify provides comprehensive guides on SEO best practices, including canonical tags. Reviewing these resources can provide additional insights and ensure you’re following best practices.

By ensuring that the canonical_url variable is correctly set and pointing to the preferred URL, you should be able to resolve the canonicalization issues flagged by Screaming Frog.

 

I hope that my solution works for you.

Best regards,

Amelia | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 
➜ Weekly updated Shopify tutorials on YouTube 


All features are available from Free plan. Live Chat Support is available 24/7.