CMS Items -- conditional visibility on whole page?

Hi there!

I have a project that is using a CMS collection for ‘Partners’

There is a toggle within the CMS collection that toggles between an ‘actual partner’ and an ‘example partner’.

For ‘actual partners’ I would like to keep the item template page live and indexable by Google – but for the ‘example partners’ – I am using these as leads to a lead generation form – and I don’t want to actually display/index/publish the item template pages.

Is there any way around this?
I thought about adding the “no robot” html tag in the header of the item template – but this would also remove indexing from the ‘actual partners’ – whereas ideally these remain published and indexable.

Any advice is greatly appreciated.

Best wishes,

In your collection, add a Robots select, with two options;

  • noindex, for pages you want to block robots
  • all for pages you want to allow robots

Those two should be enough but there are others.

Set this field to required in your collection, and populate every record to make certain it’s one of those two values.

Then in your collection page head, create your robots META and for the value, insert the select field you’ve created above.

1 Like

Very elegant, thank you.

I would just add that with a bit of extra code on the designer side, these properties in the CMS collection can be named to something more readable for your editors sake, like ‘public’ and ‘private’ for example – these can then be mapped onto the appropriate robot tags ‘all’ and ‘noindex’ in the header using some basic custom code and a dictionary.

Generally speaking that will work great for those who are comfortable with scripting- however make certain that the scripts run synchronously with the page.

In my tests, Google often does not pick up and apply deferred or async scripts before it does its indexing work.