I am looking for the right code snippet for setting a collection page to noindex, but its tagged pages must remain indexable.
So for example:
…/collections/widget is the collection to be set to noindex
but
…/collections/widget/blue and …/collections/widget/green etc are to remain indexable
Something like the following sets every page to noindex, I have tried different variations as well.
{% if template contains ‘collection’ and canonical_url contains ‘/collections/widget’ %}
{% endif %}
but the inclusion of something like and current_tags == false breaks and nothing is set to noindex
What is the correct code to exclude the tagged pages from being set to noindex?