How can I prevent Google from indexing specific tag-filtered pages on my website?

Hello,

I just noticed that some URL pages of my website are indexed with the tag of filters, as well as our regular pages. How can I explain to google, to do not index those pages with filters/tags?

For example, I have a meta title on google: E-Shop - My Website - Tagged "category__outerwear, size__ …

and a URL: https://mywebsite.fr/collections/all/size__xxl%20category__outerwear

Can you help?

Best,

Nicolas.

1 Like

Yeah I’ve just come across this and am wondering 1) whether it is a problem? 2) how I can fix it if so. I’m going to keep searching by am not an expert - let me know if you have come across anything! :slightly_smiling_face:

Same here - is there a way to locate the filter and set rules? So far I can use metafield with noindex set to false or true, but I don’t want to filter pages to be indexed.

Hi, I have tried with the next code in theme.liquid but is not working;

{% if template contains “collection” and collection.handle == “?filter” %}

{% endif %}

{% if handle contains ‘?filter=’ %}

{% endif %}

Any help?

I also blocked it in robots.txt with;

{{ ‘Disallow: /collections/*?filter’ }}

Try

{% if template contains “collection” and collection.handle contains “?filter” %}

?

Thanks @Vin-Twinwoods but it does not work. Any other idea?

1 Like

Try this set in your theme header - you can modify to fit your needs.

  • note I also set metafield to collection or page so it is a quick solution for you too.
{% if handle contains 'types' or template contains 'search' or template contains 'cart' %}
{% elsif product_url contains 'view=list' %}
{% elsif request.page_type == 'collection' or request.page_type == 'page' %}
{% if template contains 'collection' and current_tags %}
{% elsif template contains 'collection' and product_url contains 'page=' %}
{% elsif collection.metafields.robots.noindex == 'false' or page.metafields.robots.noindex == 'false' %}
{% else %}
{% endif %}
{% elsif product_url contains 'variant=' or product_url contains 'currency=' %} 
{% else %}
{% endif %}

I have the same problem and tried everything. The problem is that the URL for filtered collection pages contains a question mark (?) which is not in Shopify’s URL handle so you can’t target it with this code.