是否可以使用itemref链接到多个itemcope。这是场景:
我在一个页面上有一些博客帖子,每篇博文都有相同的人员和组织元信息。而不是在每篇博文中包含人员和组织的所有元信息,而是可以引用该信息吗?我可以用一个参考,例如人:
<div id="person" itemscope itemprop="author" itemtype="http://schema.org/Person">
<span itemprop="name">Joe Blogs</span>
</div>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
<div itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
<span itemprop="name">Organization</span>
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="600">
<meta itemprop="height" content="60">
</div>
</div>
</article>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
<div itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
<span itemprop="name">Organization</span>
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="600">
<meta itemprop="height" content="60">
</div>
</div>
</article>
但是还没有能够用2个参考文献做到这一点:
<div id="person" itemscope itemprop="author" itemtype="http://schema.org/Person">
<span itemprop="name">Joe Blogs</span>
</div>
<div id="organization" itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
<span itemprop="name">Organization</span>
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="600">
<meta itemprop="height" content="60">
</div>
</div>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person" itemref="organization">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
</article>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person" itemref="organization">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
</article>
或者:
<div id="person" itemscope itemprop="author" itemtype="http://schema.org/Person">
<span itemprop="name">Joe Blogs</span>
</div>
<div id="organization" itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
<span itemprop="name">Organization</span>
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="600">
<meta itemprop="height" content="60">
</div>
</div>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
<meta itemref="organization" itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
</article>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person">
<a href="/" itemprop="mainEntityOfPage"><h1 itemprop="headline">Title</h1></a>
<time datetime="2016-01-01 12:00:00" itemprop="datePublished">1st Jan</time>
<time datetime="2016-01-02 12:00:00" itemprop="dateModified">2nd Jan</time>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="image.jpg">
<meta itemprop="url" content="http://example.com/image.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="400">
</div>
<meta itemref="organization" itemscope itemprop="publisher" itemtype="http://schema.org/Organization">
</article>
通过https://developers.google.com/structured-data/testing-tool/运行这两个错误。虽然至少第三个例子表明正在进行组织参考。
答案 0 :(得分:0)
itemref
属性可以采用多个值,以空格分隔。
所以而不是
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person" itemref="organization">
使用
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person organization">