Schema.org - 重复的项目类型?

时间:2013-08-12 03:59:58

标签: schema.org microdata

我正在将Schema添加到我正在构建的联系页面中。该页面有一个物理地址,这是一个办公室,但是,邮寄地址是不一样的。以下是我使用Schema所做的事情:

<div itemscope itemtype="http://schema.org/LocalBusiness">   
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
 <ul>
  <li>Office: <span itemprop="streetAddress">1234 Anywhere Street</span>
   <br/> <span itemprop="addressLocality">Denver</span>, <span itemprop="addressRegion">CO</span> <span itemprop="postalCode">80000</span>
  </li>
 </ul>            
</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
 <ul>
  <li>Mailing: Post Office Box <span itemprop="postOfficeBoxNumber">5555</span>
  <br/> <span itemprop="addressLocality">Denver</span>, <span itemprop="addressRegion">CO</span> <span itemprop="postalCode">80000</span>
  </li>
 </ul>
</div> 
<div>
 <ul>
  <li>Phone: <span itemprop="telephone">555-555-5555</span></li>
  <li>Fax:  <span itemprop="faxNumber">555-555-5555</span></li>
 </ul>
</div>      
</div>    

我的问题:

  • 拥有两个<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
  • 实例在技术上是否正确
  • 如果不是,我该如何离开第二个<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">

正确的方法是什么?

1 个答案:

答案 0 :(得分:2)

从语法的角度来看,这在技术上是正确的。但不幸的是,人们没有机会从这样的标记中理解什么是什么。我宁愿使用一些更具描述性的属性。例如location表示实际地址,contactPoint表示邮寄地址。 所以看起来应该是这样的

<div itemscope itemtype="http://schema.org/LocalBusiness">   
  <div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
   <ul>
    <li>Office: <span itemprop="streetAddress">1234 Anywhere Street</span>
     <br/> <span itemprop="addressLocality">Denver</span>, <span itemprop="addressRegion">CO</span> <span itemprop="postalCode">80000</span>
    </li>
   </ul>            
  </div>
  <div itemprop="contactPoint" itemscope itemtype="http://schema.org/PostalAddress">
   <ul>
    <li><span itemprop="contactType">Mailing: Post Office Box</span> <span itemprop="postOfficeBoxNumber">5555</span>
    <br/> <span itemprop="addressLocality">Denver</span>, <span itemprop="addressRegion">CO</span> <span itemprop="postalCode">80000</span>
    </li>
   </ul>
  </div> 
  <div>
   <ul>
    <li>Phone: <span itemprop="telephone">555-555-5555</span></li>
    <li>Fax:  <span itemprop="faxNumber">555-555-5555</span></li>
   </ul>
  </div>      
</div>   

请注意,我已添加 itemprop =“contactType”以明确指定联系人点的类型。虽然它是简单的文本(属性类型)所以你可以使用你喜欢的任何描述。

另一个小注意事项是,我们可以使用schema.org/PostalAddress作为contactPoint,因为它是http://schema.org/ContactPoint类型的子项。