我有一个FAQ页面,我想用更好的html模式来实现它。
<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具有待定状态,并且在中不进行验证。
你觉得这个计划怎么样?这是正确的吗?
发布于 2018-02-02 16:13:06
FAQPage将是页面的最佳类型。如果您不想在发布之前使用它,WebPage是最好的选择。您还可以考虑现在使用这两种类型,并在WebPage成为核心词汇表的一部分时立即删除FAQPage (或者,如果它转到阁楼,则删除FAQPage ):
<main itemscope itemtype="http://schema.org/WebPage http://schema.org/FAQPage">我不会使用mainContentOfPage属性。它需要一个WebPageElement,这通常并不有用。
在您的示例中,Question项没有连接到WebPage项。为此,您可以使用属性。
<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>(我切换了article和section元素,因为我认为这样做在语义上更有意义。)
https://stackoverflow.com/questions/48581089
复制相似问题