Schema warning about QAPage on Question type

烂漫一生 提交于 2019-12-22 18:47:17

问题


I have a page with multiple Question and Answers and I'm getting the following warning on each question:

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


This is example markup:

<div itemscope="" itemtype="http://schema.org/Question">
  <h3 class="question" itemprop="name text">This is the question?</h3>
  <div class="answer" id="IdForTheAnswer" itemprop="acceptedAnswer" itemscope="" itemtype="http://schema.org/Answer">
    <div itemprop="text">
      <p>This is the answer text.</p>
    </div>
  </div>
</div>

And below is the example warning from https://search.google.com/structured-data/testing-tool/ :

Question | 0 ERRORS | 1 WARNING

@type
- Question
  - name    
    - This is the question?
  - text    
    - This is the question?
  - acceptedAnswer
      - @type   
        - Answer
      - @id 
        - https://www.example.com/IdForTheAnswer
      - text    
        - This is the answer text.
warning 
  - Missing a QAPage markup item on page to which this item should be associated.

What is this warning actually asking me to provide?

What I've tried unsuccessfully so far:

  1. Remove the id from the acceptedAnswer
  2. Use suggestedAnswer instead of acceptedAnswer
  3. Provide the Question with a mainEntityOfPage

回答1:


Ok so after an entire day of trying I finally stumbled on the answer.

I was getting that same warning if I removed everything but the question item, so it's something related to that. I tried a lot of things and on a hunch I ended up wrapping the whole collection of questions in this:

<div itemscope itemtype="http://schema.org/FAQPage">
  <!-- Rest of Q&A markup -->
</div>

And now I get valid schema without any errors or warnings.

I feel like the documentation and error messages are not very good, or I just don't understand this ecosystem and its resources yet!

p.s. I also tried the QAPage itemtype but that requires a lot more props and doesn't actually describe the page I'm building, so FAQPage comes closest.



来源:https://stackoverflow.com/questions/52203521/schema-warning-about-qapage-on-question-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!