一个组织的网站,比如"Sun Industries",想要添加一份员工名单.组织的地址和联系信息已存在于网页上,但员工列表将位于其他位置.
所以我们有
<div id="organization" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
<span itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Technologies Street 42</span>,
<span itemprop="addressLocality">Venustown</span>
<span itemprop="postalCode">98765</span>
</span>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
以后我们将在HTML5代码中
<div id="employee-1" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试将以下子项添加到"employee-1"对象中
<meta itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" itemref="organization">
Run Code Online (Sandbox Code Playgroud)
但这不起作用(至少在谷歌的结构化数据测试工具中没有).
itemref在这种情况下,如何正确使用微数据属性?为了清楚起见,我还尝试了以下方法:
itemprop="worksFor"到"组织"对象.itemref="organization"到"员工"对象.所以
<div id="organization" itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
...
</div>
...
<div id="employee-1" itemscope itemtype="http://schema.org/Person" itemref="organization">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales …Run Code Online (Sandbox Code Playgroud) 我有一个公司页面,其上列有所有本地分支机构.
对于每个酒店,我正在尝试使用元标记添加branchOf属性,但Yandex和Google Snippets都为此属性显示为空白.有可能这样做吗?
<div itemscope itemtype="http://schema.org/Organization" id="schema-organization">
<meta itemprop="description" content="blah blah blah" />
<a href="/" itemprop="url">
<h1 itemprop="name">The Hotel Chain</h1>
</a>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="addressLocality">new york city</div>
<meta itemprop="addressRegion" content="NY" />
</div>
</div>
<!-- snip -->
<div itemscope itemtype="http://schema.org/Hotel">
<meta itemprop="branchOf" itemref="schema-organization" />
<h2 itemprop="name">Hotel Location 1</h2>
<a href="http://maps.google.com/blahblah" itemprop="map">Get directions on Google Maps</a>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="40.7450605" />
<meta itemprop="longitude" content="-73.98301879999997" />
</div>
<div class="wrap-address clearfix" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<ul class="ul-reset">
<li><span …Run Code Online (Sandbox Code Playgroud)