0

I have a table of villages within a city. I plan on adding schema.org microdata on each of these villages to specify their relation to their parent city. As I am just learning about microdata, I am a confused about how the property containedInPlace works in relation to Place, especially in a table will links. Will this syntax be semantically correct?:

<article itemscope itemtype='http://schema.org/Place'>
  <h1><span itemprop='name'>San Andres</span></h1>

  <table>
    <thead>
      <tr>
        <th>Village name</th>
        <th>Description</th>
        <th>Other info</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>
          <a itemprop='containedInPlace' href='/santa-ana.html'>Santa Ana</a>
        </td>
        <td>Description</td>
        <td>Other info</td>
      </tr>
      <tr>
        <td>
          <a itemprop='containedInPlace' href='/santiago.html'>Santiago</a>
        </td>
        <td>Description</td>
        <td>Other info</td>
      </tr>
    </tbody>
  </table>

</article>

Since itemscope itemtype='http://schema.org/Place' was placed in the <article> tag which contains the table, do the villages containing itemprop='containedInPlace' relate now to the city San Andres?

JAT86
  • 997
  • 12
  • 24

1 Answers1

2

For Microdata, it doesn’t matter on which HTML elements it gets specified (as long as you use itemprop on elements with suitable datatype). So there is nothing special about using table instead of e.g. div etc.

Your example conveys that the place "San Andres" is part of two places which are identified by the URIs /santa-ana.html and /santiago.html. If you want to convey that the two places are part of San Andres, you have to use the property containsPlace instead of containedInPlace.

And if you want to provide more data about these places on that page (e.g., their names), you have to provide items (with itemscope) instead of just URL values.

<tr itemprop="containsPlace" itemscope itemtype="http://schema.org/Place">
  <td>
    <a itemprop="url" href="/santa-ana.html"><span itemprop="name">Santa Ana</span></a>
  </td>
  <td itemprop="description">Description</td>
  <td>Other info</td>
</tr>

(And always use the most specific type available. For example, for a city you should use City instead of the parent type Place.)

unor
  • 92,415
  • 26
  • 211
  • 360
  • Thank you. But in the code you have provided, since you declared another itemtype, will it override the previous city itemtype in
    ? How will I be able to add another itemprop referring back to the city?
    – JAT86 Mar 27 '18 at 01:36
  • 1
    @JAT86: 1) Each `itemscope` creates a new item. There is no concept of overwriting anything. 2) If you say `Place[1] containsPlace Place[2]`, there is typically no need to also say `Place[2] containedInPlace Place[1]`, as the properties `containsPlace` and `containedInPlace` are defined to be inverse. You can still add this, if you want, e.g., with a `link` element: `` (which would just be a URL value, again). – unor Mar 27 '18 at 13:04