Ton*_*ido 1 microdata schema.org
我正在将Microdata添加到页面中,我正在尝试将事件列表与superEvent相关联,但在检查时我无法使其工作:http://www.google.com/webmasters/tools/richsnippets q =
这里的概念代码:
<div id="main" itemscope="main" itemtype="http://schema.org/Event">
<span itemprop="name">Main
</div>
<div itemscope="event" itemtype="http://schema.org/Event">
<span itemprop="name">Event
<span itemprop="superEvent" itemref="main">
</div>
Run Code Online (Sandbox Code Playgroud)
任何的想法?
您的微数据存在问题:
itemscope 是一个布尔属性,所以你不应该给它像"main"或"event"这样的值.
该itemref属性只能用于元素itemscope,因此您不能像这样使用它.
要通过subEvent/ superEventproperties 链接事件,您可以使用该itemref属性或嵌套项目.
使用itemref和superEvent,它可能看起来像:
<div itemprop="superEvent" itemscope itemtype="http://schema.org/Event" id="main">
<span itemprop="name">Main</span>
</div>
<div itemscope itemtype="http://schema.org/Event" itemref="main">
<span itemprop="name">Event</span>
</div>
Run Code Online (Sandbox Code Playgroud)
使用itemref和subEvent,它可能看起来像:
<div itemscope itemtype="http://schema.org/Event" itemref="secondary">
<span itemprop="name">Main</span>
</div>
<div itemprop="subEvent" itemscope itemtype="http://schema.org/Event" id="secondary">
<span itemprop="name">Event</span>
</div>
Run Code Online (Sandbox Code Playgroud)
嵌套(不使用itemref)可能如下所示:
<div itemscope itemtype="http://schema.org/Event">
<span itemprop="name">Main</span>
<div itemprop="subEvent" itemscope itemtype="http://schema.org/Event">
<span itemprop="name">Event</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)