How can I prevent product variants from being indexed in SEO?

Maxime07
Visitor
1 0 1

Hello,

I have a question about how to prevent variants from being indexed.
Could you confirm this solution is corrected ?
 
So i put this is into theme.liquid :

 

 

{% if handle contains '?variant' %} <meta name="robots" content="noindex"> {% endif %}

Replies 2 (2)

Salil1
Shopify Partner
32 3 13

Hi @Maxime07 

 

I dont think you can use the `handle` parameter to detect a variant. 

In any case, you have the following `canonical` tag

<link rel="canonical" href="https://www.myamericanshop.com/products/yankee-candle-tree-farm-festival-petite-jarre">

 

Canonical is telling google to show only the product page instead of the variant page. I don't think you need to have any custom robots tag.

Co-Founder AdNabu, Creator of Goshu - Backups, Restore & Export, Nabu for Google Shopping, Facebook & Instagram

flareAI
Shopify Partner
2405 223 535

Hello @Maxime07,


It's flareAI - your Fully Automated Free Sales Machine here. We are helping Shopify merchants provide solutions for the last few years in Shopify Community.


If helpful, please consider Like and Accept solution.


You can correctly set the canonical URL for the variants. The canonical URL element informs Google and other search engines to crawl a website, and what URL to index that specific page’s content under. You can read this blog on canonical URLs 


$10+ billion in eCommerce on Google Search every day. Sadly, for only 4% of the stores. Find out instantly how much of your Shopify store is missing from customer searches on Google https://flareai.co/FOG.


If you found the answer helpful consider supporting the Shopify Community by giving it a Like + Accept the solution.


Gina
flareAI

flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing