Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement schema.org containedIn?

I'm marking up a property listing website with Schema.org microdata. The hierarchy of my website is arranged like so:

-City
--Region
---Postcode
----Area

Each of these are individual pages with links to one another, all marked up with the Place itemtype. I'd like to use the containedIn property to describe the relationship between these different pages, but couldn't find any examples of how to best do this.

E.g. on a "region" page, I have the following to link back to "city", but am unsure if this is sufficient or correct:

<meta itemprop="containedIn" content="New York">

Surely pointing the search engines to the actual city page URL for New York would be more useful than just giving a name? Anyone have any hints or references for this?

like image 784
simonrohrbach Avatar asked Oct 18 '12 13:10

simonrohrbach


1 Answers

Here is one example of how you could choose to mark this up. The schema.org markup is very flexible, so there is not just one way to do it.

<div itemscope itemtype="http://schema.org/Residence">
<span itemprop="name">Property Listing 1</span><br />
<a href="http://www.mypropertylisting.com/property1" itemprop="url">Property One</a><br />
    <span itemprop="telephone">555-555-5555</span><br />
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="streetAddress">555 N. Anywhere Street</span><br />
        <span itemprop="addressLocality">Somewhere</span>,
        <span itemprop="addressRegion">LA</span> <span itemprop="postalCode">55555</span>
        <span itemprop="addressCountry">USA</span>
    </div>
<div itemprop="containedIn" itemscope itemtype="http://schema.org/Place">
<span itemprop="name">Metropolitan Area</span>
<a href="http://www.mypropertylisting.com/metropolitan1" itemprop="url">LA Metropolitan Area</a>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="34.065174" />
<meta itemprop="longitude" content="-118.240585" />
</div>
</div>
</div>

You can verify that this works as expected by using Google's Structured Data Testing Tool -> http://www.google.com/webmasters/tools/richsnippets

There may be a better way of specifying the location other than using the "geo" itemprop, but with geo coordinates you know for sure that you're targeting the right location. Look through the schema.org site for other properties that you can use and then use the google Structured Data Testing Tool to test the markup you create.

Good luck!

like image 91
mbrinson Avatar answered Oct 17 '22 09:10

mbrinson