Amazing, I will play with that.
A use case could be this, for example:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "",
"acceptedAnswer": {
"@type": "Answer",
"text": "lorem ipsum"
}
},{
"@type": "Question",
"name": "",
"acceptedAnswer": {
"@type": "Answer",
"text": "Dolor sit amet"
}
},{
"@type": "Question",
"name": "",
"acceptedAnswer": {
"@type": "Answer",
"text": "Lorem ipsum"
}
},{
"@type": "Question",
"name": "",
"acceptedAnswer": {
"@type": "Answer",
"text": ""
}
}]
}
</script>
So in this example, we have three FAQ questions with answers. Its main entity should be generated dynamically, with a comma between them. The last one must be without a comma for the code to stay valid.
This way, we could have a FAQ page with an accordion looper for example that generates the visible FAQs, but at the same time the second looper is generating the JSON-LD FAQ structured data.
There are many other Structured data opportunities to utilize with this approach, covering things that the native Snippet addon cannot do.
Thanks!