How can i prevent google to do not index my product variant urls,

jaiseo
Visitor
1 0 0

How can I prevent Google from indexing my product variant URLs? I have added canonical tags, but Google is still picking and indexing variant URLs like  (products/abc?variant=30091910873171 . )

Replies 2 (2)

RhysV
Shopify Partner
2 0 1

Also looking for answer on this one.

RhysV
Shopify Partner
2 0 1

Hi Jaiseo,

 

This canonical tag finally worked for me.

 

{% if template == 'product' %}
<link rel="canonical" href="{{ shop.url }}{{ product.url | split: '?' | first }}" />
{% endif %}

 

Note, I have "within: collection" removed from the url.

Cheers