Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

html - Using itemprop="branchOf" from schema.org Microdata to refer to LocalBusiness's parent company

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 LocalBusinesses with the Corporation mentioned earlier in the page.

How should I do this? Can an element id be used for this?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is possible with the use of the itemref attribute:

  1. Add itemprop="branchOf" to the body
  2. Add an id to the body, e.g. id="foo"
  3. Add itemref="foo" to both article

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...