I'm trying to set schema to my HTML page. The validator (https://developers.google.com/structured-data/testing-tool) fails at this page:
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div itemscope itemtype="http://schema.org/SportsEvent">
<h1 itemprop="name">Event name</h1>
<p itemprop="description">Some text description ...</p>
<time itemprop="startDate" datetime="2016-03-16T16:00:00+01:00">16.3.</time> - <time itemprop="endDate" datetime="2016-03-20T16:00:00+01:00">20.3.2016</time>
<span itemprop="location">29-31 Craven Rd,London W2 3BX</span>
</div>
</body>
</html>
As you can see it tells me location address can not be empty.
I also tried to use utils: http://schema-creator.org/event.php But even I filled all inputs the result was same: "Error invalid location."
<div itemscope itemtype="http://schema.org/SportsEvent">
<a itemprop="url" href="https://www.myevent.com">
<div itemprop="name"><strong>Me super event</strong>
</div>
</a>
<div itemprop="description">super event
</div>
<div>
<meta itemprop="startDate" content="2016-03-06T12:00">Starts: 03/06/2016 12:00PM
</div>
<meta itemprop="endDate" content="2016-03-12:00.000">Ends: 2016-03-12:00.000
</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">29-31 Craven Rd,London W2 3BX
</div>
<div>
<span itemprop="addressLocality">London
</span>,
<span itemprop="addressRegion">United kingdom
</span>
</div>
</div>
Can someone explain me how to specify location?
EDIT: As @unor tald me the location must be instance of PostalAddress, so I modified it:
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div itemscope itemtype="http://schema.org/SportsEvent">
<h1 itemprop="name">Event name</h1>
<p itemprop="description">Some text description ...</p>
<time itemprop="startDate" datetime="2016-03-16T16:00:00+01:00">16.3.</time> - <time itemprop="endDate" datetime="2016-03-20T16:00:00+01:00">20.3.2016</time>
<span itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">29-31 Craven Rd</span>
<span itemprop="address">29-31 Craven Rd,London W2 3BX</span>
<span itemprop="name">Test</span>
</span>
</div>
</body>
</html>
But it is still not valid, it looks then address in PostalAddress must be Place, but in Place there must be PostalAddress :-(
Your markup is correct according to Schema.org: the location
property may contain Text.
When Google’s SDTT reports an error, it doesn’t necessarily mean that your markup is wrong. Often it just means that you won’t get one of Google’s search result features for your page.
In your case, the error is related to Google’s Event Rich Snippet. For showing this snippet, Google requires that the location
property has a Place
or a PostalAddress
item as value, but not Text (although Google also says "A text string is permitted […]", but their testing tool doesn’t seem to like it).
Your second snippet does that, but it doesn’t nest the div
with the location
property in the div
for the SportsEvent
, so the location is not associated with the event.
About your third snippet: It seems to be a bug in the testing tool that it requires an address
property for PostalAddress
(Schema.org doesn’t define one). If you care about the "errors" the testing tool reports, it should work if you use Place
as value for location
, with an address
that has a PostalAddress
item as value. It also works if you provide Place
and use Text in the address
property:
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="name">Test</span>
<span itemprop="address">29-31 Craven Rd, London W2 3BX</span>
</div>