![](/img/trans.png)
[英]Can we add itemscope & itemtype on <HTML> tag for microdata schema?
[英]HTML5 Microdata - itemref to multiple itemscope's
是否可以使用itemref鏈接到多個itemscope。 這是場景:
我在一個頁面上有一些博客帖子,每個博客帖子都有相同的人員和組織元信息。 而不是在每篇博文中包含人員和組織的所有元信息,而是可以引用該信息嗎? 我可以用一個參考文獻來做,例如人:
<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/運行這兩項操作都會出錯。 盡管至少第三個示例顯示正在進行組織引用。
itemref
屬性可以采用多個值,以空格分隔。
而不是
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person" itemref="organization">
采用
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="person organization">
¹引用。 WHATWG規格: itemref
/ W3C注意: itemref
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.