I want to implement schema markup for FaqElement via cloudflare

Hey i am new to cloudflare and workers. I want to implement schema markup for FaqElement via cloudflare worker. I made a worker that has hardcoded script like this.
const schemaMarkup = {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is Lorem Ipsum?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer"
}
},
{
"@type": "Question",
"name": "Why do we use it?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer 2"
}
},
{
"@type": "Question",
"name": "Where does it come from?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer 3"
}
}
// Add more FAQ items as needed
]
};
const schemaMarkup = {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is Lorem Ipsum?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer"
}
},
{
"@type": "Question",
"name": "Why do we use it?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer 2"
}
},
{
"@type": "Question",
"name": "Where does it come from?",
"acceptedAnswer": {
"@type": "Answer",
"text": "answer 3"
}
}
// Add more FAQ items as needed
]
};
My question is if i can tell worker to set answers and questions dynamically from HTML (from class name for example), i cant seem to make it work with HTMLRewriter class.
2 Replies
vakno
vaknoOP11mo ago
what is this?
zegevlier
zegevlier11mo ago
I've deleted it, seemed like spam
Want results from more Discord servers?
Add your server