This two links are exact the same content with different urls. One is home collection and one is clicked in other pages.
How could I fix this or to get the home collection product link to redirect to the product link?
This is intended behaviour from Shopify, it will create multiple links for each collection a product is in. This isn't a problem for duplicate content as the canonical link is always set to the original product (So, google is told where the original is and not to mark down for duplication).
However, if you do want to change this, it needs to be done in the theme's .liquid files that build the links to your products. This will vary theme to theme, but in "Supply" (the one I'm using) you can find the relevent line of code in the Snippets section, as "product-grid-item.liquid". We're looking for the link to the products, like this:
<a href="{{ product.url | within: current_collection }}" class="product-grid-item">
The important part is inside the brackets {{ }}. product.url is used to generate the url for the product, but this also has a 'within' filter applied to it. This within filter makes sure that the link that's generated includes a reference to the current collection. Seeing as you want the URLs all to point to /products/ you can just remove that filter. So that snippet would like like this:
<a href="{{ product.url }}" class="product-grid-item">
More info is available here: https://help.shopify.com/themes/liquid/filters/url-filters#within
I would love to know if anyone has a solution for this that would work for the Debut theme?
I would like collection pages to point to the canonical URL for each product (i.e. /products/) rather than the default non-canonical URL (/collections/.*/products/).
Hey there,
For Debut, all you need to do is locate the file "product.card.grid.liquid" under "snippets" and change line 2 the same way that was mentioned above.
So change:
<a class="grid-view-item__link grid-view-item__image-container full-width-link" href="{{ product.url | within: current_collection }}">
to:
<a class="grid-view-item__link grid-view-item__image-container full-width-link" href="{{ product.url }}">
WOOT!
Theme: Mr Parker
For theme: Mr Parker, all you need to do is edit code under snippets, locate the file product-listing.liquid and change lines 1 and line 32
Line 1 and 32 from:
<a href=”{{ product.url | within: collection }}”>
Line 1 and 32 to:
<a href=”{{ product.url }}”>
User | Count |
---|---|
19 | |
17 | |
13 | |
11 | |
11 |