Removing Categories From Product URLs

Matt_Sawyer
Tourist
13 0 1

I am crawling my site at the moment, and currently I'm up to about 15,000 URls and rising.

Most of the issues seem to being caused by product URLs that are resolving under multiple categories, for example,

collections/category1/product/productname1
collections/category2/product/productname1
collections/category3/product/productname1

Which is of course duplicating the same page over and over again. 

These pages canonicalise correctly back to the single product URL, but generating all of these URL varients isn't good for crawling by serach engines.

Is there a way that I can force all product links to default to the single products/productname and remove the categories from the URL completely?

 

0 Likes
Mircea_Piturca
Shopify Partner
1459 39 284

The collection part of your URL is created by the "within" filter in Liquid, see: https://help.shopify.com/themes/liquid/filters/url-filters#within

You can remove that and your product links will bypass the collection name.

Finally—Add variant descriptions to your products
Matt_Sawyer
Tourist
13 0 1

Where files should I edit in my theme to achieve this?

0 Likes
Mircea_Piturca
Shopify Partner
1459 39 284

I do not know what your theme is.

You can look in to collection.liquid. There may be an {% include %} that is getting the single product.

Look into snippets for something like "product-grid-item" or "product-thumbnail" but it can be anything really.

Finally—Add variant descriptions to your products
Matt_Sawyer
Tourist
13 0 1

Okay, I'll have a search around and see what works.

One more clarification. I notice in the first link that you sent,

When a product is collection-aware, its product template can access the collection output of the collection that it belongs to. This allows you to add in collection-related content, such as related products.

Will removing this from my URL also remove other functionality such as related products on product pages?

 

0 Likes