Shopify – Collection Product URLs to Clean Product URLs {{ product.url | within: collection }}

Sitebee

Technical SEO
Staff member
product.url | within: collection
Shopify is a fantastic eCommerce platform for getting online stores up and running with relative ease. However, out of the box, Shopify does have some SEO disadvantages. One of the disadvantages is internal linking from collections (product category) to the product page.

Shopify has a problem with internal passing SEO value (link equity) from the product category pages to the actual products. The problem is that by default the actual product URL path is housed within the category path like this: “/collections/all/products/test-product”. The canonical and XML sitemap version of the product URL path is “/products/test-product”.

Technically speaking, the link equity is diminished to the product URL, the full value of an internal linking strategy is at jeopardy. I’m going to show you how to overcome that disadvantage.

Start by logging in to the Shopify administration panel. Head over Themes > Edit Code > Snippets. Find and open the “Product-grid-item.liquid” file. Locate this liquid snippet {{ product.url | within: collection }}, remove the “| within: collection”.
shopify-admin.JPG



Here is that instruction again:​

Locate the file: Product-grid-item.liquid

Find

Code:
{{ product.url | within: collection }}

replace with

Code:
{{ product.url }}

Save the file, navigate back to your website’s product collection page and refresh the browser window. Click on one of the products. If everything went as planned, you should reach the direct product URL path.

shopify-admin2.JPG


The internal links from collections to the product should no longer be “/collections/all/products/test-product”. The overall outcome of this Shopify hack should lead to increased organic search visibility for your products. The full link equity will be passed from collections to products.

Outro – let me caveat this tutorial with I have used the Shopify default theme called Debut. Your Shopify theme may have a slightly different theme file hierarchy. You should speak with the theme author or developer for further advice. You can hire me on a consultancy basis if you need seasoned Shopify SEO guidance.

I have created a short browser capture video to show the exact steps taken. See below:
 
Last edited: