Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Any help would be appreciated, thanks!
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:
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.
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 }}">
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 }}">
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.
Verify with Screaming Frog: After making these changes, re-crawl your site with Screaming Frog to ensure that the canonical tags are correctly implemented.
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.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024