Why recommended products have extra params in URL?

Hi @Djani ,

I found it in my product-card.liquid file.

I change :

{{ card_product.title | escape }}

By :

3 Likes

HI @batfink1989 , thanks for your solution.

In my case i have this kind of code ( i guess i not expert on liquid) . I found it on my produc-recommendation-section file

instead of{ product.url }}. i found {{ routes.product_recommendations_url }}

Do you know how i can change it?

Thanks for your help

@batfink1989

Thanks for you solution . my Url are clean now

Did you redirected all the long url to the canonical by a redirection on shopify? i have Thousands of url in GSC i am wondering how to manage them!

thanks

1 Like

Sorryy but its not working

Hi @Alexis_Thery , sorry for the late reply. I’m pleased that my solution helped you.

Re the redirection of the URLs, I’m not sure Shopify allows you to redirect them, so that’s the first thing I’d double check. In my case, I added a robots.txt rule to stop Google from crawling them in the first place. It’s a bit hacky and not the perfect solution, but works in the context of Shopify:

Disallow: ?pr_prod_strat=

1 Like

@Djani , sorry for the late reply. Did you manage to get this sorted?

It works for me!! I use DAWN theme.

1 Like

Hi @batfink1989 my question is do you notice in you search consol that url disapeared from your crawled but not indexate page?

No I cannot find anything in the theme where I could find something like that to delete.

FWIW, I’m using the Expanse theme and all this is changed in the product-grid-item.liquid file.

1 Like

What a pain !
But thank you for your hints , I found the solution for my theme!

FOR DAWN 12

  • Go to card.product.liquid file
  • Search for “card_product.url”
  • There should be at line 113, 157 and 235
  • Replace all by “card_product.url | split: “?” | first”
  • That’s it
    Now you have clean URL in your featured products section links

Here is the way to clean the product url:

  1. Go to store dashboard → edit code → theme.liquid

  2. Find <head tag in theme.liquid file and just in the next line paste below javascript code.