Interlinking "Organization" and "worksFor" microdata?

Kristjan

We have a website where the contact page consists of two sections: first, information about the organisation (name, phone, e-mail, registration code), and second, the contact list of all workers (with name, position, e-mail and phone number).

I can add microdata to various fields without any problem. But I would also like to interlink Organization and Person microdata with each other. So that for Persons, "worksFor" itemprop information is taken directly from the Organization itemprop="name", and later on, that under the Organization the workers are listed with "employees" or "worker" itemprop.

<div itemscope itemtype="http://schema.org/Organization">
    <span itemprop="name">Organization XXX</span>
    <span itemprop="telephone">1234567</span>
    <span itemprop="email">[email protected]</span>
    <span id="worklink" itemprop="worksfor">Organization YYY</span>
</div>
    <table>
        <tr itemscope itemtype="http://schema.org/Person" itemref="worklink">
            <td itemprop="name">Helmut York</td>
            <td itemprop="jobTitle">Analyst</td>
            <td itemprop="email">[email protected]</td>
        </tr>

        <tr itemscope itemtype="http://schema.org/Person" itemref="worklink">
            <td itemprop="name">Julius Xing</td>
            <td itemprop="name">Analyst</td>
            <td itemprop="email">[email protected]</td>
        </tr>
    </table>

However, the problem is that with this code, the Organization is also given "worksFor" itemprop, and of course, this gives an error in Google Structured Data Testing Tool. Any ideas how to solve this? The itemref attribute is very poorly documented in schema.org.

unor

You can do this with the itemref attribute, but you have to move id="worklink" and itemprop="worksFor"¹ to the element which should be added as property value.

So it could look like this:

<div itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" id="worklink">
</div>

<table>
  <tr itemscope itemtype="http://schema.org/Person" itemref="worklink"></tr>
  <tr itemscope itemtype="http://schema.org/Person" itemref="worklink"></tr>
</table>

But now you have to make sure that the Organization item has no other Microdata item as parent, otherwise it would be added via the worksFor property to this item, too.

An alternative to itemref would be to use the itemid attribute and reference the organization URI as value, but it might not be supported by every consumer.

¹ Note that URIs are case-sensitive. The property is ẁorksFor, not worksfor.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related