I’m trying to add a metadata robots tag to all children of a parent, but not to the parent itself and not sure if I can.
I have a folder of articles, and I want the articles to have the robots tags “no index, follow” automatically applied. But I don’t want the parent folder to have the same tags
Anything is possible with JavaScript Sorry, developer joke.
We have a global metadata schema that contains an SEO.Robots field. This field has the options all, noindex and noindex,nofollow. In the Meta Tag Format option we print the tag using:
<meta name="robots" content="%metadata_value%" />
This field defaults to all for the site. If you have the structure, Articles Parent > Articles Folder > Articles, and set the folder to noindex,nofollow and cascade, it should achieve what you are asking.
Let me know if that works or I have misunderstood your requirements.
If you have a prescribed layout structure you could use SSJS to calculate if the asset needs the robots tag or not, based on depth and asset type and what it’s parent is.