1docReady(function () { 2 const faqQuestionElements = document.querySelectorAll("[data-faq-schema-question]"); 3 const faqAnswerElements = document.querySelectorAll("[data-faq-schema-answer]"); 4 let faqMainEntityArray = []; 5 6 if (faqQuestionElements.length > 0) { 7 8 // MainEntity Array 9 for (let i = 0; i < faqQuestionElements.length; i++) { 10 faqMainEntityArray[i] = { 11 "@type": "Question", 12 "name": faqQuestionElements[i].dataset.faqSchemaQuestion, 13 "acceptedAnswer": { 14 "@type": "Answer", 15 "text": faqAnswerElements[i].dataset.faqSchemaAnswer 16 } 17 }; 18 } 19 20 // Create JSON-LD Script 21 const jsonldScript = document.createElement('script'); 22 jsonldScript.setAttribute('type', 'application/ld+json'); 23 24 const structuredData = { 25 "@context": "https://schema.org", 26 "@type": "FAQPage", 27 "mainEntity": [faqMainEntityArray] 28 }; 29 30 jsonldScript.innerHTML = JSON.stringify(structuredData); 31 document.head.appendChild(jsonldScript); 32 } 33});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.