SEO, AdWords, affiliates, advertising, and promotions
I have a string of urls that are being indexed but I dont want them to:
For example
https://www.crispgolf.com/collections/headwear/products/crsp-hdw-101?variant=24587625863
As we cant edit the robots.txt file (very strange) im wondering the following: this guide tells me to put this code into the header of my template to exlude urls:
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}
Now I want to exclude all url strings that contain "?variant=" so I was thinking to put the code like this
{% if handle contains '/?variant=' %} <meta name="robots" content="noindex"> {% endif %}
Though that doesnt seem to work so how would I go about this?
Thanks
Luuk - This code did work, those pages now have noindex added (see screenshot). But, why do you want to do this? All of your product pages use this string and you are going to drop all of your products from Google.
Your theme is taking a single product, and showing all the variants on the collection page. By doing that however, the theme is also linking to that specific variant - which is where that url with the variant id comes from.
You could just link directly to the product, but the drawback with that is that the default variant (the first) will be shown. So if someone clicked on one colour item they might not see that by default.
You could of course not use variants and just make these different products but that could pose a problem with dudplicate content - unless you're writing something unique for each.
Hello!
As of today, June 21st, 2021, we have launched the ability to edit the robot.txt file to give merchants more control over the information that is crawled by search engines. You can learn more about how to edit your robot.txt file through our community post here.
Due to the age of the topic, I will be locking this thread. If you have any questions about the new feature, please do not hesitate to create a new post under our "Techincal QA" board.
Trevor | Community Moderator @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
User | RANK |
---|---|
12 | |
4 | |
4 | |
3 | |
3 |
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