Kyle
Kyle

Reputation: 17677

Schema.org WebPage - isPartOf?

I'm trying to figure out how to use the isPartOf attribute in the Schema.org WebPage object.

From what I understand, this should be used to specify that your page is part of a collection. So so I have a list of hockey teams and then a list of players. My understanding is that an individual player would be a part of the team, so presumably on the players HTML page, I would add the isPartOf element.

But I'm not sure how I would add this. Should I add it as a URL to the pages collection? Or should I just add a meta tag with the collections name? I can't seem to find much about this element anywhere. Does anyone know how to properly use it?

Upvotes: 5

Views: 5069

Answers (2)

unor
unor

Reputation: 96587

The isPartOf property (and its inverse property: hasPart) can be used to convey that a CreativeWork is part of another CreativeWork. One use case is a category page (example).

While a URL value could be used, the expected way is to provide CreativeWork values (WebPage is a more specific CreativeWork):

<div itemscope itemtype="http://schema.org/WebPage">
  <h1 itemprop="name">Child page</h1>
  <p itemprop="isPartOf" itemscope itemtype="http://schema.org/WebPage">
    <span itemprop="name">Parent page</span>
  </p>
</div>
<div itemscope itemtype="http://schema.org/WebPage">
  <h1 itemprop="name">Parent page</h1>
  <p itemprop="hasPart" itemscope itemtype="http://schema.org/WebPage">
    <span itemprop="name">Child page</span>
  </p>
</div>

For a sports team

However, if you want to convey that a player is part of a team, you can’t use isPartOf/hasPart, as players and teams aren’t creative works. You would need a suitable property that can connect Person and Organization items.

Schema.org has suitable types and properties for this case now:

  • SportsTeam

    Organization: Sports team.

  • athlete

    A person that acts as performing member of a sports team; a player as opposed to a coach.

Example:

<div itemscope itemtype="http://schema.org/SportsTeam">
  <ul>
    <li itemprop="athlete" itemscope itemtype="http://schema.org/Person"></li>
    <li itemprop="athlete" itemscope itemtype="http://schema.org/Person"></li>
    <li itemprop="athlete" itemscope itemtype="http://schema.org/Person"></li>
  </ul>
</div>

The athlete property has no inverse property defined. If you want to specify this relation within a Person item, you could either use the non-standard itemprop-reverse attribute (example), or switch from using Microdata to RDFa (example) or JSON-LD (example).

Upvotes: 2

GDVS
GDVS

Reputation: 448

I think you're right: use isPartOf to indicate the parent collection (team, in this case) to which a page or file (player) belongs.

So on the player's page:

<a href="/toronto-maple-leafs/" itemprop="isPartOf">Member of the Toronto Maple Leafs</a>

And on the team page, ensure that it's marked with CollectionPage, for example:

<body itemscope itemtype="http://schema.org/CollectionPage">

Upvotes: 4

Related Questions