Hello,
Is there any way to change the schema structure (in addition to the content) depending on a CMS field?
I have a collection of articles which are different depth of information on a topic.
I would like to add a breadcrumb JSON schema in the header of the page.
I have referenced the parent articles as fields of the article.
Here is what I would like to do:
If N+1 field is set:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "NAME_OF_N+1",
"item": "URL_OF_N+1"
},{
"@type": "ListItem",
"position": 2,
"name": "NAME_OF_N"
"item": "URL_OF_N"
}]
}
</script>
If N+2 field is set:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "NAME_OF_N+2",
"item": "URL_OF_N+2"
},{
"@type": "ListItem",
"position": 2,
"name": " NAME_OF_N+1",
"item": " URL_OF_N+1"
},{
"@type": "ListItem",
"position": 3,
"name": "NAME_OF_N"
"item": "URL_OF_N"
}]
}
</script>
I used to have the header set with dynamic data from CMS, but that only works if the schema fields are the same for all items.
I’ve tried getting an answer everywhere, I hope someone can help me.
There is no need for a read-only link as I have nothing to show, I have no solution to implement this…
Thank you