问题描述
我正在创建一个简单的(当然,在我决定将其标记为Microdata之前,它会变得简单)包含公司联系信息的网页,其中包含两个办事处的业务。我为两个办公室使用schema.org和。
以下是我的HTML的相关部分:
< body itemscope itemtype =http:// schema。组织/公司>
< header>
< hgroup>
< h1>公司名称< / h1>
< h2 itemprop =description>公司描述< / h2>
< / hgroup>
< / header>
< section>
< h1>< span itemprop =name>公司名称限制< / span>办公室< / H1>
< article itemscope itemtype =http://schema.org/LocalBusiness>
< span itemprop =streetAddress>街道地址< / span>< br />
< span itemprop =addressLocality>> Locality< / span>< br />
< span itemprop =addressRegion>区域< / span>< br />
< span itemprop =postalCode>邮政编码< / span>< br />
< span itemprop =addressCountry>国家< / span>
< / p>
< p>< a itemprop =mapshref =http://maps.google.co.uk/blahblah>地图< / a>< / p>
< p>电话:< span itemprop =telephone> 01234 567890< / span>< br />
传真:< span itemprop =faxNumber> 01234 567890< / span>< br />
电子邮件:< span itemprop =email> email@domain.co.uk< / span>< br />
< a href =http://www.domain.co.ukitemprop =url> http://www.domain.co.uk< / a>< / p>
<! - itemprop =branchOf - >
< / article>
< article itemscope itemtype =http://schema.org/LocalBusiness>
< span itemprop =streetAddress>街道地址< / span>< br />
< span itemprop =addressLocality>> Locality< / span>< br />
< span itemprop =addressRegion>区域< / span>< br />
< span itemprop =postalCode>邮政编码< / span>< br />
< span itemprop =addressCountry>国家< / span>
< / p>
< p>< a itemprop =mapshref =http://maps.google.co.uk/blahblah>地图< / a>< / p>
< p>电话:< span itemprop =telephone> 01234 567890< / span>< br />
传真:< span itemprop =faxNumber> 01234 567890< / span>< br />
电子邮件:< span itemprop =email> email@domain.co.uk< / span>< br />
< a href =http://www.domain.co.ukitemprop =url> http://www.domain.co.uk< / a>< / p>
<! - itemprop =branchOf - >
< / article>
< / section>
< / body>
当前我有<! - itemprop =branchOf - - >
,我相信我需要将 LocalBusiness
es与 Corporation
关联在页面的前面。
我应该怎么做?可以使用一个元素ID为这个?
谢谢。
通过使用 itemref
属性,这是:
- 将
itemprop =branchOf
添加到/ code>
- 将
id
添加到body
中,例如id =foo
- 将
itemref =foo
文章
缩小范例:
< body id =fooitemprop =branchOfitemscope itemtype =http://schema.org/Corporation>
< span itemprop =name>公司名称限制< / span>
< article itemscope itemtype =http://schema.org/LocalBusinessitemref =foo>
< span itemprop =name>公司名称,地址1 Office< / span>
< / article>
< article itemscope itemtype =http://schema.org/LocalBusinessitemref =foo>
< span itemprop =name>公司名称,地点2办公室< / span>
< / article>
< / body>
I'm creating a simple (well, it was going to be simple before I decided to mark it up with Microdata) web page containing company contact information for a business with two offices. I'm using schema.org and LocalBusiness for the two offices.
Here are the relevant parts of my 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>
Where I currently have <!-- itemprop="branchOf" -->
, I believe I need to associate the LocalBusiness
es with the Corporation
mentioned earlier in the page.
How should I do this? Can an element id be used for this?
Thanks.
This is possible with the use of the itemref
attribute:
- Add
itemprop="branchOf"
to thebody
- Add an
id
to thebody
, e.g.id="foo"
- Add
itemref="foo"
to botharticle
Reduced example:
<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>
这篇关于使用itemprop =“branchOf”从schema.org Microdata引用LocalBusiness的母公司的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!