All things Shopify and commerce
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 have a try. And thank you for the detailed explanation.
I have deleted the in both product-list-item.liquid and product-list-item.liquid, but it did not work.
If someone share the link, there are two kinds. It would split the link juice, that's why I would like to change it.
Thanks ! It worked for Brooklin theme. I cant believe Shopify marked this post as outdated and didnt even give us an answer on such an important topic
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!
Thank you. Actually I have since changed to Turbo theme... I'm hoping this fix will work there too!
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 }}”>
Hi,
Turbo you can fix this by editing the product-details.liquid snippet
Hello,
I have a Venue Theme and I installed the Smart Filter App.
I have several links for the same final product url and I do not find where I can remove the text you mention;
Could someone help me on this?
Thanks!
Hi there,
Any idea where to look on the venture theme ?
I've been looking through many files and did not come with the URL structure
{{ product.url | within: current_collection }}
Thanks 🙏
OK I found it in product-card.liquid
The URL is unified,but the website name appears in the product title.
I am working on wookie theme, i want to shorten my url from
to
https://the13thstore.in/kota-doria-red-blue-unstitched-salwar-suit-dupatta-fabric-1
Can you provide a solution
Hi,
I am trying to make this correction with the Parallax theme but am unable to find the correct file in Snippets. I have searched all the templates that begin with "product." Can you please throw me a line here? What file would I find it in?
Thanks,
Stuart
Did you figure this out? I am using the same theme.
I am using the Mobilia theme, did anyone find the snippet/line for that one?
Been looking for almost an hour and still not finding it ...
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023