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?
anyone could help?
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 }}”>
For shella theme: Go to snippet -> product-res-variables.liquid -> Line 22 -> Change {%- assign url = product.url | within: collection -%} in to {%- assign url = product.url -%}
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
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
For the Wokiee theme, you can edit this in Snippets under product-grid-item-design-1.liquid
It's in a few places in that liquid file.
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 ...
After opening literally every .liquid, found it in the product-thumbnail, i'm so stupid haha
Hi where would I find this for the Responsive theme?
I have the same issue. I need my product page needs to be indexed instead of the collection page.
how can I do it??
Hi - I can't find this code in the corresponding snippet in the minimal theme... can you point me in the right direction? many thanks! lk
I am also looking for this code in the minimal theme..
Hello everybody,
I have modified the code in snippets for my theme "Debut", however the links for both [product] and [product in collection] still work separately. Could anybody give further instruction?
Appreciate!
Has anyone figured out how to do this with the minimal theme?
For Minimal theme go to Snippets > product-grid-item.liquid
On about line 25 you should see a line that starts with <a href="{{ featured.url | within: collection }}" change this part to <a href="{{ featured.url }}"
Basically deleting | within: collection from the link. This should give all your product pages URLs of the form "site/products/product-link". It does alter the breadcrumb links so that rather than having Home > Collection Link > Product Link if you've navigated via a collection it changes the breadcrumb to Home > Product Link instead.
I'm using the Minimal theme, but I have no product-grid-item.liquid under Snippets. Can you advise? Thanks. --MS
I am currently having this same issue with the minimal theme but I don't have the code that you are referencing here. I do have the file product-grid-item.liquid but it doesn't have the within: collection code. Do you have any other suggestions? Thanks.
@ScullysLLC - Ultimately, I solve the issue through an app that happened to fix this. The app is Boost Product Filter and Search. I have used that app for over a year to get more robust product filtering on collection pages. They have a setting that allows you to "Use Canonical URLs for Product Pages". That did it!
I have the same problem. After I adopted your code, my collections URL became what I wanted,
https://www.kuoser.com/collections/dog-jackets-coats
But my breadcrumb lack collections. Any ideas on the complete breadcrumb? What code should i add?
https://www.kuoser.com/products/plaid-reversible-dog-winter-jacket
Hi folks,
Late to the party but we did some digging last year and found a solution to the duplicate product URLs. The theme.liquid file varies, but this should be able to point people in the right direction. https://intellitonic.com/blog/an-seo-tutorial-for-handling-shopifys-duplicate-collections-and-produc...
Great article. I am using the Flex theme from Out Of The Sandbox.
After going through all of the liquid files in FLEX, I found:
<a href="{{ product.url | within: collection }}">
in a few locations:
product-slider.liquid
product-thumbnail.liquid
product-thumbnail__product-info.liquid
product-thumbnail__quick-shop-button.liquid
include-featured-product.liquid
product-thumbnail__swatch.liquid - *this file is actually handling {{ variant.url | within: collection }}
I've altered all but the last...removing the 'within:collection'.
Unfortunately, there is no change.
Any ideas as to what I am missing?
Hi I've the same issue.
Did you find a solution to put back your collections links in your product page ?
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!
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!
I have now gone through the code of all the pages. Does anyone have any idea where I can find this in the theme Context (by Fluorescent)?
I have searched myself silly in the .-liquid files, but unfortunately could not find anything so far. Maybe someone knows where I can find the code line in the Sense theme.
Wow, 5 years on from the original issue and this is still an issue.
Shopify developers have not learnt that the original issue of canonical duplicates, stop your website being crawled by google. i Currently have 5000+ pages not crawled or listed on google because of this issue.
Shopify support's response is to connect to shopify experts that want to charge me $400+ to fix the issue, when I'm reading I can just change a piece of code (but I can't locate it in the refresh them).
I think it's time to take my business elsewhere away from shopify and the lack of support is shocking.
User | RANK |
---|---|
19 | |
17 | |
17 | |
14 | |
13 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023