Duplicate product urls fashionopolism theme.

Duplicate product urls fashionopolism theme.

ImStillLearning
Excursionist
51 0 6

hello 

I have been trying to find why since I upgraded to the fashionopolism theme, that my products will have different urls depending on which collection i clicked the product on. I was previously on the Dawn theme and didnt encounter this to this degree. 
I have read that I am supposed to change this <a href="{{ product.url | within: collection }}" class="product-card"> but i cannot find that bit of code in any of the files.

Does anyone happen to know much about this at all?
Thank you.

Replies 3 (3)

kevinkarma55
Shopify Partner
94 10 11

Hi,

Have you tried reaching out to the theme developer? I'm not familiar with that theme but usually, if its develops nicely, I believe it might be in any files with a name similar to 'product-card.liquid', 'card.liquid', OR anything with 'card' and also try finding with collection.liquid files

One other solution which is not recommended if you are not the developer is to download file and find it in a code editor like VS Code.

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me
ImStillLearning
Excursionist
51 0 6

Hello

Yes I have contacted the theme developer and this was there response:
The only way to do this would be to set up a robots.txt file to have google block indexing certain collections. The theme makes every collection visible, because every merchant has different needs, and it would be impossible to tell what collections would need to be hidden for certain merchants.

Unfortunately, the theme itself does not come with a robots.txt file, nor do we support adding in or troubleshooting a robots.txt file. Shopify automatically provides one for every store and can be viewed once it is created inside the theme files. Once it is created, you can edit it to match your needs. Here is a guide that may be useful for this: https://help.shopify.com/en/manual/promoting-marketing/seo/editing-robots-txt

Which is ZERO help. And I have noticed that now every single item is creating its own collection page as well now. And as I cant actually go in and edit these its hurting my SEO.

I came across this post while having a google:

You’ll need to edit that line of code from:

<a href="{{ product.url | within: collection }}" class="product-card">

To:

<a href="{{ product.url }}" class="product-card">

This can be done by deleting the “ | within: collection” portion of the code. Older Liquid theme templates make reference to the now-deprecated current_collection which matches the solution in the forum link provided above. The important thing to find is the “|” pipe to the “within” filter name to Shopify’s collections and remove it.



 

ImStillLearning
Excursionist
51 0 6

Just a FYI for anyone stumbling across this post.
I was able to figure it out myself.
The files to be edited are the product-grid-add.liquid 

Search for {{ product.url | within: collection }} in these files and change it from:
<a href="{{ product.url | within: collection }}" class="button select--options">
{{ 'products.product.select_option' | t }}
</a>

 

to:  <a href="{{ product.url }}" class="button select--options">
{{ 'products.product.select_option' | t }}
</a>

and product-listing.liquid change

From <a href="{{ product.url | within: collection }}" title="{{ product.title | escape }}">

 

 to <a href="{{ product.url }}" title="{{ product.title | escape }}">