4

The following Answer schema gives a warning in Google’s SDTT:

Missing a QAPage markup item on page to which this item should be associated.

Microdata:

<div itemscope itemtype="http://schema.org/Question">
    <h1 itemprop="name">What is attr_accessor in Ruby?</h1>
    <div itemprop="upvoteCount">196</div>
    <div itemprop="text">I am having difficulty understanding Ruby attr_accessors, can someone explain them?</div>
    <div>asked <time itemprop="dateCreated" datetime="2010-11-04T20:07Z">Nov 11 '10 at 20:07</time></div>
    <div itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">someuser</span>
    </div>
    <div><span itemprop="answerCount">4</span> answers</div>
    <div itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
        <div itemprop="upvoteCount">1337</div>
        <div itemprop="text">
        (The text of the accepted answer goes here...).
        </div>
        <div>answered <time itemprop="dateCreated" datetime="2010-12-01T22:01Z">Dec 1 '10 at 22:01</time></div>
        <div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">anotheruser</span></div>
   </div>
   <div itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
       <div itemprop="upvoteCount">39</div>
       <div itemprop="text">
      (Another explanation would go here).
   </div>
   <div>answered <time itemprop="dateCreated" datetime="2010-12-06T21:11Z">Dec 6 '10 at 21:11</time></div>
   <div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">lonelyuser1234</span></div>
   </div>
</div>

Is this markup not true for Google at this time?

unor
  • 92,415
  • 26
  • 211
  • 360
Gdefit
  • 41
  • 1
  • 2

3 Answers3

3

Like the warning says, Google recommends to provide a QAPage item, probably for qualifying for one of Google’s search result features.

You can associate your Question to the QAPage via the mainEntity property:

<div itemscope itemtype="http://schema.org/QAPage">
  <div itemprop="mainEntity" itemscope itemtype="http://schema.org/Question">
    <!-- … -->
  </div>
</div>
unor
  • 92,415
  • 26
  • 211
  • 360
2

You should also take in mind if this is a QAPage (which only handles an individual question as stated) or a FAQPage (with one or more questions & answers, as stated as well). The last one is still on the pending extension, but it looks it is close to be released into the schema spec, per https://searchengineland.com/google-confirms-new-faqs-qa-and-how-tos-for-search-results-snippets-303116.

In any case, you should be able to wrap all of your Question and Answer schema markup within the markup of these other specs, at least for QAPage and FAQPage, which both extend from WebPage (already stablished inside the schema spec).

You can take a look at how SO does it inside the <html> tag, at least for the QAPage spec, which seems more like the thing you need: enter image description here

Also, these are some SO questions that might be related to yours:

2019-05-08 - EDIT: The FAQPage is now an official extension:

AnhellO
  • 855
  • 1
  • 14
  • 16
-2

This day i was searching for something similar, in the past my html code whas ok but shcema.org is always changin. I check out your code and the erros and requirements were the same for my code. I re-write by my own the code and i have the answer.

Now if you whant to solve the problem (probably in a few months its wrong what im writing) try this

itemscope="" itemtype="http://schema.org/FAQPage" itemprop="mainEntity" itemscope="" itemtype="http://schema.org/Question"

REMOVE itemscope itemtype="http://schema.org/Question" and add at the end one more div (i have problems to copy the full code add properly de starting and ending divs

Blanca
  • 1
  • 1