html – 使用schema.org Microdata中的itemprop =“branchOf”来指代LocalBusiness的母公司

前端之家收集整理的这篇文章主要介绍了html – 使用schema.org Microdata中的itemprop =“branchOf”来指代LocalBusiness的母公司前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在创建一个简单的(好吧,在我决定用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” - >,我相信我需要将LocalBusinesses与页面前面提到的公司联系起来.

我该怎么做?可以使用元素id吗?

谢谢.

解决方法

这是 possible with the use of the itemref attribute

>将itemprop =“branchOf”添加到正文中
>向身体添加身份证明,例如ID = “foo” 的
>在两篇文章添加itemref =“foo”

减少的例子:

<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>

猜你在找的HTML相关文章