Quick FAQ Schema Generator
Boost your SERP real estate by generating valid JSON-LD FAQ schema markup for your WordPress posts.
function generateWPSchema() {
var q = document.getElementById('wp_faq_q').value;
var a = document.getElementById('wp_faq_a').value;
if (!q || !a) {
alert('Please enter both a question and an answer.');
return;
}
var schemaObj = {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": q,
"acceptedAnswer": {
"@type": "Answer",
"text": a
}
}]
};
var scriptWrap = '\n' + JSON.stringify(schemaObj, null, 2) + '\n';
document.getElementById('wp_code_out').innerText = scriptWrap;
document.getElementById('wp_schema_res').style.display = 'block';
}
function copyWPCode() {
var text = document.getElementById('wp_code_out').innerText;
var elem = document.createElement('textarea');
document.body.appendChild(elem);
elem.value = text;
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
alert('Schema copied to clipboard!');
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
button:hover { opacity: 0.9; }