10

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.

Be Brave Be Like Ukraine
  • 7,596
  • 3
  • 42
  • 66
David Oliver
  • 2,424
  • 1
  • 24
  • 37

4 Answers4

5

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>
Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
1

You can use @itemref for this, have a look at this example - I normally use Philip's Live Microdata service to test it.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66
  • Thanks @Michael. I'm still not sure I'm understanding or approaching this correctly. In the past, I've dabbled a very little with RDFa, and I believe that allowed me to point to an element such as "http://companydomain.co.uk/#company" which acted as the reference to a thing (the company) itself. It could explicitly link something (e.g. a company office) with something else (e.g. the company). From what I've read on `itemref`, I don't see how I can do this. Am I right in thinking this is not possible with Microdata as it is basically item value pairs, or am I just not understanding correctly? – David Oliver Jul 01 '11 at 07:07
  • Update: I now have `

    Office of Company Name

    `. Google's Rich Snippet checker gives me `Item office-place: branchof = Office of Company Name, Ref to item: Item( companyelementid )`. As you can see, the value of branchOf still seems to be the textual value of the element ("Office of Company Name"), but it does see the itemref to the element which describes the company("companyelementid"). The "Live Microdata" tool you linked to merely shows my textual value. So it's not clear to me whether this is correct or not.
    – David Oliver Jul 01 '11 at 07:34
0

Since "branchOf" refers to an Organization and an Organization has a url (like everything), I guess "branchOf" should point to the url of the Organization.

  • Thanks @Jens. I had seen that every "thing" has a URL property which is described as "URL of the item". I've given the element which is the itemscope of the company an id, and then used an anchor as the branch element and made the href point to the domain followed by the id of the company element. I.e.: `Office of Company`. Google's Rich Snippets checker tells me `branchof = http://www.companydomain.co.uk/#companyname', which would seem to be correct. I'm not 100% sure this is done and dusted, but it seems the most likely so far. – David Oliver Jul 01 '11 at 07:27
0

I think you should try this:

<p id="office-place" itemprop="branchOf" itemscope itemtype="http://www.schema.org/Organization"><span itemprop="name">Company Name</span></p>
Ivan
  • 1