Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi Guys
I am hoping someone can help me please, I would like to arrange my sites product and collection pages, so they canonicalise correctly for ranking purpose.
I would like my product pages to canonicalise to the collections equivelent.
e.g I would like the below page
https://website/products/foam-roller-set
to canonicalise to:
website/collections/foam-rollers/products/foam-roller-set
<link rel="canonical" href="https://website/collections/foam-rollers/products/foam-roller-set" />
And the below URL to self canonicalise,
website/collections/foam-rollers/products/foam-roller-set
<link rel="canonical" href="https://website/collections/foam-rollers/products/foam-roller-set" />
So Google knows that
https://website/collections/foam-rollers/products/foam-roller-set
Is the URL I want to rank, I have tried adding the canonical tag via an app, but it doesn't work correctly.
So I assume I would have to edit the theme to do this.
Is there a way to drill into individual pages in the editor, or would it have to be a code snippet in the <head>
Any help would be greatly appreciated.
Thanks guys, Kind regards.
Hi Lloydy,
First, understand this:
- Shopify auto-adds a canonical tag pointing to the URL without 'collections'
- The product may be included in multiple collections; how would you prioritize the collection URL in this case?
My suggestion is to go with a metafield-based canonical setup. We recently implemented a similar solution for one of our clients.
- Create product metafields for canonical URLs
- Modify the theme.liquid file to render those URLs in place of canonical dynamically
Once this is done, you'll need to manually specify the canonical URL in the metafield from the product edit section.
Let me know if you need help with this setup.