从今天开始,我一直在试图弄清楚这个谜语。 假设我们有如下电视剧集,
<main itemscope itemtype="https://schema.org/TVEpisode">
<h1>
<a itemprop="url" href="self.html">
Pokemon - <span itemprop="episodeNumber">88</span>
</a>
</h1>
<h2 itemprop="name">In the Pink</h2>
<p>Source: <span itemprop="partOfSeries">Pokemon</span>
<span itemprop="partOfSeason">Orange Islands</span>
</p>
</main>
现在的问题是我无法在此处添加“partOfSeries”的“sameAs”属性。如果我在“partOfSeries”中添加一个带有“sameAs”属性的 anchor ,Google 结构化数据测试工具会说它无法找到 sameAs 属性。而且我不知道还能做什么。对于“partOfSeason”的子项“seasonNumber”也是如此。 如果您也可以帮助解决“potentialAction”属性,那就太棒了。 谢谢
最佳答案
partOfSeason
property期望值为 Season
type .
partOfSeries
property期望值为 Series
type .
在这两种情况下,您都给出了一个文本值。
这是 not wrong (只是不推荐),但是对于文本值,不可能提供有关季节/系列的额外数据。
在微数据语法中,您必须使用 itemscope
属性创建一个新的 item 并使用 itemtype
属性为其指定类型:
<span itemprop="partOfSeries" itemscope itemtype="http://schema.org/Series">
<span itemprop="name">Pokemon</span>
</span>
<span itemprop="partOfSeason" itemscope itemtype="http://schema.org/Season">
<span itemprop="name">Orange Islands</span>
</span>
(因为项目内的简单文本不被视为微数据值,所以您必须为要与该项目关联的所有内容使用一个属性,即 Schema.org 中的 name
这种情况。)
现在您可以添加仅适用于其 parent (系列
/季节
)的附加属性,而不适用于TVEpisode
:
<span itemprop="partOfSeries" itemscope itemtype="http://schema.org/Series">
<span itemprop="name">Pokemon</span>
<link itemprop="sameAs" href="http://en.wikipedia.org/wiki/Pok%C3%A9mon_%28anime%29"/>
</span>
<span itemprop="partOfSeason" itemscope itemtype="http://schema.org/Season">
<span itemprop="name">Orange Islands</span>
<link itemprop="sameAs" href="http://en.wikipedia.org/wiki/List_of_Pok%C3%A9mon:_Adventures_on_the_Orange_Islands_episodes"/>
</span>
关于你的例子的旁注:
- 您正在使用带有
https
协议(protocol)的 Schema.org URL。没有错,但是I recommend to always usehttp
. - 您不应该为替代标题使用额外的标题元素(在您的情况下为
h2
);您可以改用p
,并将标题与header
中的替代标题分组(请参阅 HTML5 的 Subheadings, subtitles, alternative titles and taglines)。
关于seo - Schema.org 属性的子属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28777149/