Metadata tags on children but NOT parents


#1

Matrix Version: 4.0.0

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

Is this possible?


(Michael Wilson) #2

Anything is possible with JavaScript :stuck_out_tongue: 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.


(Nick Papadatos) #3

Why not just restrict assets to standard page if they’re sitting inside a parent folder?


#4

One limitation of that approach is that the fields do not appear on the parent so you can’t cascade.


(Bart Banda) #5

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.