Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schema.org for the FAQ page

I have a FAQ page and I want to do it with better html-schema.

<main role="main" itemscope itemtype="http://schema.org/WebPage">
  <article itemprop="mainContentOfPage">
    <header>
      <h1>Frequently Asked Questions</h1>
    </header>
    <section itemscope itemtype="http://schema.org/Question">
      <h2 itemprop="name">Some question #1</h2>
      <p itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
        <span itemprop="text">This is an answer #1</span>
      </p>
    </section>
    <section itemscope itemtype="http://schema.org/Question">
      <h2 itemprop="name">Some question #2</h2>
      <p itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
        <span itemprop="text">This is an answer #2</span>
      </p>
    </section>
    <section itemscope itemtype="http://schema.org/Question">
      <h2 itemprop="name">Some question #3</h2>
      <p itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
        <span itemprop="text">This is an answer #3</span>
      </p>
    </section>
  </article>
</main>

I think a better type for the page is FAQPage instead of WebPage, but FAQPage has pending status and doesn't validate in Google Structured Data Testing Tool.

What do you think about this scheme? Is it correct?

like image 244
Sergey Eroshenkov Avatar asked Oct 27 '25 08:10

Sergey Eroshenkov


1 Answers

FAQPage will be the best type for the page. If you don’t want to use it until it’s released, WebPage is the best alternative. You could also consider using both types for now, and remove WebPage as soon as FAQPage is part of the core vocabulary (or remove FAQPage if it goes to the attic):

<main itemscope itemtype="http://schema.org/WebPage http://schema.org/FAQPage">

I wouldn’t use the mainContentOfPage property. It expects a WebPageElement, which is typically not useful.

In your case, the Question items aren’t connected to the WebPage item. For this, you could use the hasPart property.

<main itemscope itemtype="http://schema.org/WebPage http://schema.org/FAQPage">

  <section>

    <h2 itemprop="name">Frequently Asked Questions</h2>

    <article itemprop="hasPart" itemscope itemtype="http://schema.org/Question"></article>
    <article itemprop="hasPart" itemscope itemtype="http://schema.org/Question"></article>
    <article itemprop="hasPart" itemscope itemtype="http://schema.org/Question"></article>

  </section>

</main>

(I switched the article and section elements because I think it makes more sense that way, semantically.)

like image 112
unor Avatar answered Oct 28 '25 22:10

unor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!