sightly - loop elements over the script
Hi all,
I would like to generate script element in sightly as shown below and I've sightly list which gives me name & text.
---- SIGHTLY LOOP---
<sly data-sly-list.page="${testModel.faqs}">
name: ${page.name}
text: ${page.text}
</sly>
-------------------------------------
EXPECTED OUTPUT:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
{
"@type": "Question",
"name": "How long does it take to process a refund?",
"acceptedAnswer": {
"@type": "Answer",
"text": “description goes here”
}
}, {
"@type": "Question",
"name": "What is the policy for late/non-delivery of items ordered online?",
"acceptedAnswer": {
"@type": "Answer",
"text": “description goes here”
}
}]
}
</script>
Could you please help how can we integrate sightly list inside script ?