I was doing a quick audit of a friend’s website recently, and discovered something rather annoying about the site.
On a collection page, Shopify added the slug of the current collection, to all the product links on that page.
So every time a product was listed in a different collection, it would have a different link pointing in.
Each of these links correctly pointed to the primary product URL with the canonical tag, but that tag doesn’t work like it used to.
Google is also assigning weight to each of the links coming into the page.
This caused a product URL that contained the collection, to compete with the actual product URL.
The URL from a collection page was:
domain.com/collections/<collection>/products/<product-slug>
Yet the actual product URL was;
domain.com/products/<product-slug>
Why does Shopify add the collection or a product URL?
There are a couple potential reasons, with the main stemming from the user experience.
When the collection is added on the URL, breadcrumbs can get updated to point back to that collection.
If a user enters from 2 different collections, they’d see two different breadcrumbs, and then be able to go back to their original ‘search’ via the links.
However, this minor improvement in UX is written off by the poor SEO performance this can generate.
How to remove the collection from a product URL in Shopify
You can remove the collection from the Shopify product URL, by following these steps;
1. Access your collections layout design, presumably located at Snippets > product-card-grid.liquid
2. Remove the collections portion of the product URL, but replacing {{ product.url | within: collection }} with {{ product.url }}
Solution/image source: Shopify
Collections folder removed from URL
The collections folder will now be removed from the product URL giving you a cleaner Shopify site.
The primary URL being linked to is essential for SEO, so this should provide good value once patched up.
In addition to solving this issue, did you ensure that at one one of the collections could set proper breadcrumbs on the product page? I’m working with a client now with this issue. I’d like to remove the /collection product URLs, but also want to be able to choose a collection to set breadcrumbs other than Home > Product on the product page.
Thanks so much for this post! I am looking to exactly this at the moment but am wondering what happens with all the old collection page urls then? Won’t there be a ton of 404s? Is there any simple way to sort this (if manual re-directs aren’t possible)? Many thanks, Lauren
The old collection URLs actually still exist. Removing the links just means Google won’t discover new URLs with the collection in the URL.
To patch this properly, you will then need to 301 redirect all the collection + product URLs, to the primary product URL.
You could bulk generate a list of possible URLs of all collections + all products, or just products + the collections they’re in, and then implement those redirects. However, I’d say just look in search console at your indexing / crawl stats pages, and try export the URLs that you see are product URLs with the collection included, and then just redirect those.