Question and answer page (Q&A Page) schema markup is a schema.org type that is used for pages that contain a question and one or multiple answers to that question.
It's great for FAQ pages, or for a page with a single question proposed, and multiple answers given by users.
It's also great for SEO purposes because structured pages are better indexed by Google.
Q&A Page Schema Markup requires 3 schema classes:
- QAPage ( https://schema.org/QAPage )
- Question ( https://schema.org/Question )
- Answer ( https://schema.org/Answer )
To create a QAPage Structured FAQ page:
- just after the <!DOCTYPE html> tag insert:
<html itemscope itemtype=”http://schema.org/QAPage”>
- each question needs to be proposed as:
<div itemscope itemtype=”http://schema.org/Question”>
<div itemprop=”text”>Who is John Doe?</div>
</div>
- and each following answer as:
<div itemscope itemtype=”http://schema.org/Answer”>
<div itemprop=”text”>John Doe a fictitious name used in legal proceedings for a male party whose true name is not known.</div>
</div>
A full and simple FAQ page code example using Microdata:
<div itemscope itemtype="http://schema.org/FAQPage">
<div itemscope itemprop="mainEntity" itemtype="http://schema.org/Question">
<h2 itemprop="name" class="classyschema-faqpage-question">Who is John Doe?</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="http://schema.org/Answer">
<div itemprop="text">
<p>John Doe a fictitious name used in legal proceedings for a male party whose true name is not known.</p>
</div>
</div>
</div>
<div itemscope itemprop="mainEntity" itemtype="http://schema.org/Question">
<h2 itemprop="name" class="classyschema-faqpage-question">How old is John Doe?</h2>
<div itemscope itemprop="acceptedAnswer" itemtype="http://schema.org/Answer">
<div itemprop="text">
<p>No one knows how old is John Doe.</p>
</div>
</div>
</div>
</div>
the result of this code is:
Who is John Doe?
John Doe a fictitious name used in legal proceedings for a male party whose true name is not known.
How old is John Doe?
No one knows how old is John Doe.
NOTE
You can customize code by adding a class attribute, such as:
<div itemscope itemprop="acceptedAnswer" itemtype="http://schema.org/Answer" class="my-CSS-class">
After having compiled the page, check it using the Google Rich Results Test Tool: https://search.google.com/test/rich-results?hl=en