CMS & Breadcrumb schema

Hello everyone!

I am trying to know whether it’s possible to generate a JSON schema structure depending on which CMS fields are set.

I’ll try to explain: I have set up a CMS collection of articles with some reference fields to refer to parents:

  • N+1 meaning direct parent
  • N+2 meaning parent of N+1
  • N+3 meaning parent of N+2

So depending on the depth of the article in the topic cluster, I have:

  • some articles with N+1
  • some articles with N+1 & N+2
  • some articles with N+1 & N+2 & N+3

How to have a json breadcrumb schema for all levels of articles?
Sometimes the JSON will only have two levels, sometimes three…

Could javascript help with that? Is there another solution?

I thought using microdata and conditional visibility would do the trick but the hidden microdata still shows in the code of the body.

What do you think?

Thanks a lot for your help.
Joachim

Read-only
Live