我正在创建一个简单的(好吧,在我决定用Microdata标记它之前很简单)网页,其中包含有两个办公室的公司的公司联系信息。我在两个办公室使用schema.org和LocalBusiness。
以下是我的HTML的相关部分:
<body itemscope itemtype="http://schema.org/Corporation">
<header>
<hgroup>
<h1>Company Name</h1>
<h2 itemprop="description">Company description</h2>
</hgroup>
</header>
<section>
<h1><span itemprop="name">Company Name Limited</span> Offices</h1>
<article itemscope itemtype="http://schema.org/LocalBusiness">
<h2 itemprop="name">Company Name, Location 1 Office</h2>
<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Street Address</span><br />
<span itemprop="addressLocality">Locality</span><br />
<span itemprop="addressRegion">Region</span><br />
<span itemprop="postalCode">Postcode</span><br />
<span itemprop="addressCountry">Country</span>
</p>
<p><a itemprop="maps" href="http://maps.google.co.uk/blahblah">Map</a></p>
<p>Telephone: <span itemprop="telephone">01234 567890</span><br />
Fax: <span itemprop="faxNumber">01234 567890</span><br />
Email: <span itemprop="email">email@domain.co.uk</span><br />
<a href="http://www.domain.co.uk" itemprop="url">http://www.domain.co.uk</a></p>
<!-- itemprop="branchOf" -->
</article>
<article itemscope itemtype="http://schema.org/LocalBusiness">
<h2 itemprop="name">Company Name, Location 2 Office</h2>
<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Street Address</span><br />
<span itemprop="addressLocality">Locality</span><br />
<span itemprop="addressRegion">Region</span><br />
<span itemprop="postalCode">Postcode</span><br />
<span itemprop="addressCountry">Country</span>
</p>
<p><a itemprop="maps" href="http://maps.google.co.uk/blahblah">Map</a></p>
<p>Telephone: <span itemprop="telephone">01234 567890</span><br />
Fax: <span itemprop="faxNumber">01234 567890</span><br />
Email: <span itemprop="email">email@domain.co.uk</span><br />
<a href="http://www.domain.co.uk" itemprop="url">http://www.domain.co.uk</a></p>
<!-- itemprop="branchOf" -->
</article>
</section>
</body>
我目前有<!-- itemprop="branchOf" -->
的位置,我认为我需要将LocalBusiness
es与页面前面提到的Corporation
相关联。
我该怎么做?元素id可以用于此吗?
感谢。
答案 0 :(得分:3)
这是possible with the use of the itemref
attribute:
itemprop="branchOf"
添加到body
id
添加body
,例如id="foo"
itemref="foo"
添加到article
简化示例:
<body id="foo" itemprop="branchOf" itemscope itemtype="http://schema.org/Corporation">
<span itemprop="name">Company Name Limited</span>
<article itemscope itemtype="http://schema.org/LocalBusiness" itemref="foo">
<span itemprop="name">Company Name, Location 1 Office</span>
</article>
<article itemscope itemtype="http://schema.org/LocalBusiness" itemref="foo">
<span itemprop="name">Company Name, Location 2 Office</span>
</article>
</body>
答案 1 :(得分:1)
您可以使用@itemref,查看this example - 我通常使用Philip的Live Microdata服务来测试它。
答案 2 :(得分:0)
由于“branchOf”指的是Organization且组织有网址(如everything),我猜“branchOf”应该指向组织的网址。
答案 3 :(得分:0)
我想你应该试试这个:
<p id="office-place" itemprop="branchOf" itemscope itemtype="http://www.schema.org/Organization"><span itemprop="name">Company Name</span></p>