Is there a way to add a meta robots noindex tag to all pages in a specific collection? Or some other way to do this at scale? I have thousands of unique sold items across several collections that I’m trying to clean up from the Google index, but it’s important that they can still be searched for on the site.
I was going to use the metafields seo.hidden approach, but soon realized that also hides it from customers being able to search for them on the site.
I was thinking if I can create a custom metafield like product.metafields.custom.hide_from_google, would I be able to add something like this to the theme.liquid to add a noindex?
{% if product.metafield.custom.hide_from_google = 1 %}
{% endif %}
Would this work?
That’s the method you’d want to use, but some issue/suggestion for your implementation.
- Your code is missing an s on metafields
- I’d suggest using a true/false boolean as your metatag type
{% if product.metafields.custom.hide_from_google == true %}
{% endif %}
1 Like
I have a question regarding this same query if I add a no-index tag to 1000 pages would that affect my site speed?
So, please help me with how I can add a no-index tag to that many pages.
Using the method in this thread, it would have no impact on site speed at all regardless of how many pages you noindexed…
though if the pages are active and linked on your site noindexing that many pages could cause site quality issues. It would be best if the noindexed pages were not linked.
To implement this method, you would add the metafield, add the code, and then you could import the metafield value to true for any pages you want to noindex.