Hey i am new to cloudflare and workers. I want to implement schema markup for FaqElement via cloudfl

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
        ]
    };


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 find an option inside HTMLRewriter class.
Was this page helpful?