相关疑难解决方法(0)

HTML5微数据 - itemref到另一个itemscope(人为组织工作)

一个组织的网站,比如"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)

我们如何将两个对象"组织"和"员工-1"链接在一起?

我尝试将以下子项添加到"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)

html5 reference microdata

19
推荐指数
2
解决办法
1万
查看次数

使用schema.org branchOf和itemref

我有一个公司页面,其上列有所有本地分支机构.

  • 在页眉上,我定义了一个OrganizationType的itemType.
  • 每个LocalBusiness(酒店)都位于页面下方.

对于每个酒店,我正在尝试使用元标记添加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)

microdata schema.org

5
推荐指数
1
解决办法
3187
查看次数

标签 统计

microdata ×2

html5 ×1

reference ×1

schema.org ×1