Shopify: Putting the collection back in breadcrumbs, after fixing the SEO

Stephen Keable
4 min readJan 14, 2023

One of the most common Shopify SEO tips is to remove the | within: collection filter on the collection template, so that your product links concentrate the link juice to one URL. See the “Duplicate product pages” section of Moz’s guide.

However a side affect of this is that on the product template, the breadcrumbs often rely on using that hint to decide the collection in the breadcrumbs. Leaving you with no breadcrumbs, or a list that just points to your homepage, nowhere else.

This is because the link between a collection and product is a “many to many” connection, meaning a product can exist in many collections and collection can contain many products. So deciding the right collection to link back to from the product page becomes difficult.

The default Shopify method of effectively passing the collection to the products page using the within filter mentioned above, works only from a human perspective, however I would argue that someone is more likely to use the browser back button or gesture, rather than clicking the on page link back to the collection (only my opinion, if you have stats from your store share in the comments).

How to decide which collection to link to?

You could pick the first collection in the product.collections array, however this will likely be the alphabetically first one, so probably not ideal, especially if you have any “All…” titled categories. Better solutions include…

Product Type or Vendor

If you have collections for product type or vendor, this might be a good choice as there is only one vendor/type per product, so there will be consistency and you will have several products that point to a collection. This of course doesn’t help stores with single vendor or types.

Using the vendor and type to create breadcrumbs

The liquid snippet below can be used to create a breadcrumb list which includes vendor and type collections. Provided you have collections created with products in them, where the vendor/type handle matches the collection…



Stephen Keable

Shopify partner, JavaScript/Liquid/Swift developer, convert to serverless architecture and builder of digital products people love to use since 1999.