gpt4 book ai didi

microdata - 标记 "mainContentOfPage"的最佳方法?

转载 作者:行者123 更新时间:2023-12-04 15:11:28 26 4
gpt4 key购买 nike

对于网页的其他区域,标记起来很简单;即导航元素、页眉、页脚、侧边栏
mainContentOfPage 并非如此;我已经看到了许多不同的实现方式,最近一次(我发现这是最奇怪的)在 schema.org itself 上。 :

<div itemscope itemtype="http://schema.org/Table">
<meta itemprop="mainContentOfPage" content="true"/>
<h2 itemprop="about">list of presidents</h2>
<table>
<tr><th>President</th><th>Party</th><tr>
<tr>
<td>George Washington (1789-1797)</td>
<td>no party</td>
</tr>
<tr>
<td>John Adams (1797-1801)</td>
<td>Federalist</td>
</tr>
...
</table>
</div>

我可以举一些例子;在这种情况下,我页面的主要内容是搜索结果页面,但我也计划在其他页面(主页、产品页面等)上使用它

编辑,我发现了更多的例子:

这会有效吗?我在一个博客上找到了这个:

<div id="main" itemscope itemtype="http://schema.org/WebPageElement" itemprop="mainContentOfPage">
<p>The content</p>
</div>

我还在另一个博客上发现了这个更简单的例子(可能太简单了?):

<div id="content" itemprop="mainContentOfPage">
<p>The content</p>
</div>

最佳答案

mainContentOfPage property可用于 WebPage 并期待 WebPageElement 作为值(value)。

但是Table不是 WebPage 的 child 和 true不是预期值。所以这个例子实际上很奇怪,因为它不遵循规范。

一位家长 WebPage应该使用 Table作为 mainContentOfPage 的值:

<body itemscope itemtype="http://schema.org/WebPage">
<div itemprop="mainContentOfPage" itemscope itemtype="http://schema.org/Table">
</div>
</body>

编辑:更新

你的第二个例子和我的一样,只是使用了更通用的 WebPageElement而不是 Table . (当然,你仍然需要一个父项 WebPage,就像我的例子一样。)

您的第三个示例不符合 schema.org 的定义,因为值为 Text 而不是预期的 WebPageElement (或子)项目。

关于microdata - 标记 "mainContentOfPage"的最佳方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23023263/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com