5

I want to get rich snippets in Google for Q&A like StackOverflow. How do I do this? What structured data do I need?

Here is the screenshot:

Google Search Results displaying question and answer rich snippets

4

You want to apply the properties identified in both the Question scheme and Answer scheme as defined on Schema.org.

In particular and at minimum, use the following attributes/properties:

  1. itemscope itemtype="http://schema.org/Question" on the DOM element wrapping entire set of question & answer content
  2. itemprop="name" (typically on an H1) wrapping the individual question
  3. itemprop="acceptedAnswer" itemscope itemtype="http://schema.org/Answer" on the DOM element wrapping the accepted answer
  4. itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer" on the DOM element wrapping other answers

You may also (optionally) want to consider attributing questions and answers to individual people/users, using the Person scheme.


Below are screenshots of one of the examples from schema.org for quick reference.

Microdata Microdata approach

RDFa RDFa approach

JSON-LD JSON-LD approach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.