首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FAQ页面的Schema.org

FAQ页面的Schema.org
EN

Stack Overflow用户
提问于 2018-02-02 10:52:24
回答 1查看 3.9K关注 0票数 3

我有一个FAQ页面,我想用更好的html模式来实现它。

代码语言:javascript
复制
<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>

我认为更好的页面类型是FAQPage而不是WebPage,但是FAQPage具有待定状态,并且在中不进行验证。

你觉得这个计划怎么样?这是正确的吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-02 16:13:06

FAQPage将是页面的最佳类型。如果您不想在发布之前使用它,WebPage是最好的选择。您还可以考虑现在使用这两种类型,并在WebPage成为核心词汇表的一部分时立即删除FAQPage (或者,如果它转到阁楼,则删除FAQPage ):

代码语言:javascript
复制
<main itemscope itemtype="http://schema.org/WebPage http://schema.org/FAQPage">

我不会使用mainContentOfPage属性。它需要一个WebPageElement,这通常并不有用。

在您的示例中,Question项没有连接到WebPage项。为此,您可以使用属性

代码语言:javascript
复制
<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>

(我切换了articlesection元素,因为我认为这样做在语义上更有意义。)

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48581089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档