Reputation: 1487
How to create Microdata markup for FAQ component when the page itself is not FAQ?
The following example is based on Google Microdata https://developers.google.com/search/docs/advanced/structured-data/faqpage but Rich Results Tool (https://search.google.com/test/rich-results) doesn't seem to recognize that at all. Unless HTML root element has additional attributes <html itemscope itemtype="https://schema.org/FAQPage">
, only in that case it works. But I would prefer to have Microdata FAQs (with different content) also on some other page types so these pages will have different itemtype on root.
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h2 itemprop="name">Question 1</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
Text text text
</div>
</div>
</div>
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h2 itemprop="name">Question 2</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
Text text text
</div>
</div>
</div>
Upvotes: 2
Views: 1321
Reputation:
Please check this:
<div itemscope itemtype="https://schema.org/FAQPage">
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h2 itemprop="name">Question 1</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
Text text text
</div>
</div>
</div>
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h2 itemprop="name">Question 2</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
Text text text
</div>
</div>
</div>
</div>
Upvotes: 0
Reputation: 371
Please try this:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "Question 1",
"acceptedAnswer": {
"@type": "Answer",
"text": "Answer 1"
}
}, {
"@type": "Question",
"name": "Question 2",
"acceptedAnswer": {
"@type": "Answer",
"text": "Answer 2"
}
},
{
"@type": "Question",
"name": "Question 3",
"acceptedAnswer": {
"@type": "Answer",
"text": "Answer 3"
}
}]
}
</script>
Upvotes: 1