All things Shopify and commerce
{%- for product in recommendations.products -%}
<li class="product">
<a href="{{ product.url }}">
...
</a>
</li>
{%- endfor -%}
Hi Yu727,
Those parameters are there for tracking purposes. I don't recommend removing them as you wouldn't know how the recommendations are performing.
You can find mentions to these parameters in the links bellow:
https://help.shopify.com/en/themes/development/recommended-products
Hi Vellir,
Is this feature automatically added on venture theme?
I have hundreds of new pages on my google search consoles with similar Url as the one in the question. I am not using any recommendation features from my theme or from the app. I was surprised to see 1k+ new urls in my search console. I believe it makes my other main pages slower to get indexed...
Any insights?
Cheers
Same here @Vellir Hundreds of URLs with that parameters are indexed. What's the solution?
Hi @Vellir
The URLs with parameters from Recommendations section are a problem for SEO. Any idea how to link the clean URL of the products?
Thanks
Hi, I have tried to do noindex that urls but it is not working. I added to theme.liquid:
My reply above is answering the original question only: "Why Recommended Products Have Extra Params In URL?"
Also, based on some other posts above some themes can also modify the URLs.
However, it seems most people here want to remove the extra parameters regardless.
It doesn't look like there's a universal solution to remove the query parameters but I'm happy to help everyone individually (or at least try). Please PM me your details if you wish me to have a look.
We can share the solution here if find one.
Is it possible for us to set the "Disallow: / xxxxx" in our robots.txt file to avoid search consoles crawling this long and meaningless URL by adding a robots.txt file or altering it via google's robots testing tools?
If this is feasible, then what should it be "Disallow: / xxxxxx"?
This is an update for the piece of code, and the piece finally works for me. See the screenshot from Google Search Console.
The code is here:
{%- if canonical_url="*seq=uniform" -%}
<meta name="robots" content="noindex, nofollow">
{%- endif -%}
Put the code at the end of your theme.liquid file.
Great!! So, the codes to insert are:
In theme.liquid (to do noindex):
{%- if canonical_url="*seq=uniform" -%}
<meta name="robots" content="noindex, nofollow">
{%- endif -%}
{% if handle contains 'seq=uniform' %}
<meta name="robots" content="noindex, nofollow">
{% endif %}
In robots.txt (to block crawler):
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /products/*?pr=*' }}
{%- endif -%}
Sorry, I did a mistake copying the code. The good code will be;
{% if handle contains 'seq=uniform' %}
<meta name="robots" content="noindex">
{% endif %}
Hello Frankymartin,
have you found any solution with this code ?
I have facing same problem with extra url parameters.
Hey @frankymartin
I will try this code snippet in my theme.liquid. did you already find out if its working properly?
I mean this one:
{% if handle contains 'seq=uniform' %}
<meta name="robots" content="noindex">
{% endif %}
I have the same issue but I am not a developer and I don't know how to fix it. Does anyone have a solution? I have hundreds of canonical URLs, and I am trying to work on SEO.
Hi guys,
Think i might have a solution for this.
You can disallow these pages using the robots.txt file which helps to control which pages are crawled on your site.
You can search for robots in your theme files to locate this or If you haven't created one follow the instructions below:
From your Shopify admin, click Settings > Apps and sales channels.
From the Apps and sales channels page, click Online store.
Click Open sales channel.
Click Themes.
Click Actions, and then click Edit Code.
Click Add a new template, and then select robots.
Click Create template.
Then in the robots.txt add a disallow rule for these parameter:
Disallow: /?pr_prod=
Sorryy but its not working
I know I'm late to answer this, but I wouldn't advise necessarily just blocking the URLs in robots.txt file as you're losing a lot of internal linking. Ideally, you'd find a way to remove the params from the URL (I'm currently looking into doing this myself). That way you keep the internal linking but remove the proper canonical error in GSC. You can track 'recommended products' performance using GA4 and create an event specifically for recommended product clicks.
The solution to this varies from theme to theme but it's something along the lines of changing {{ product.url }} to {{ product.url | split: "?" | first }} in the relevant theme file that contains the 'recommended products' liquid.
I've changed a few of these now and they were in different places and named different things (e.g. one file was named "card-product.liquid" while another was named "product-thumbnail.liquid"), but you can work out where you need to change this with a bit of digging.
By changing this code, the URL that is generated no longer includes the recommended product params but still includes the link to the canonical product URL, meaning you get a clean-looking URL and some 'brownie points' for internal linking too.
Hopefully, this helps. I'd be happy to help anyone who needs some guidance, whether that's to do with this specifically or the GA4 tracking that you may want to implement afterwards.
Hi, well done for that! I'm a seo and that would be the ideal solution.
However, in my case I can't find this {{ product.url }} in my recommendation section. If you have any tips on what to change here..
Hi @Djani ,
I found it in my product-card.liquid file.
I change :
<div class="card-wrapper">
<a href="{{ card_product.url | default: '#' }}" class="full-unstyled-link">
<span class="visually-hidden">{{ card_product.title | escape }}</span>
</a>
By :
<div class="card-wrapper">
<a href="{{ card_product.url | default: '#' | split: "?" | first }}" class="full-unstyled-link">
<span class="visually-hidden">{{ card_product.title | escape }}</span>
</a>
My problem is solved
thx @batfink1989
It works for me!! I use DAWN theme.
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
No I cannot find anything in the theme where I could find something like that to delete.
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
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
Hi @Alexis_Théry , 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=*
Hi @batfink1989 my question is do you notice in you search consol that url disapeared from your crawled but not indexate page?
FWIW, I'm using the Expanse theme and all this is changed in the product-grid-item.liquid file.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024