1

I am testing Microdata + Schema.org for an Event but the Google Testing Tool says the location is missing although it's been provided.

Any idea what I am messing up?

<div itemscope itemtype="http://schema.org/SocialEvent">
<a itemprop="url" href="www.convention-name.org"><div itemprop="name"><strong>Bob's Convention</strong></div>
</a>
<div itemprop="description">blah blah blah blah blah</div>
<div><meta itemprop="startDate" content="2015-05-01:00.000">Starts: 2015-05-01:00.000</div>
<meta itemprop="endDate" content="2015-05-02:00.000">Ends: 2015-05-02:00.000
</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">55 street</div>
<div><span itemprop="addressLocality">Nashville</span>, <span itemprop="addressRegion">TN</span></div><div itemprop="postalCode">37225</div>
<div itemprop="addressCountry">usa</div>
</div>
2

You are missing some closing </div> tags. If I correctly interpret your intentions, it should look like this:

<div itemscope itemtype="http://schema.org/SocialEvent">

  <a itemprop="url" href="www.convention-name.org"><div itemprop="name"><strong>Bob's Convention</strong></div></a>
  <div itemprop="description">blah blah blah blah blah</div>
  <div><meta itemprop="startDate" content="2015-05-01:00.000">Starts: 2015-05-01:00.000</div>
  <div><meta itemprop="endDate" content="2015-05-02:00.000">Ends: 2015-05-02:00.000</div>

  <div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
    <div itemprop="streetAddress">55 street</div>
    <div>
      <span itemprop="addressLocality">Nashville</span>,
      <span itemprop="addressRegion">TN</span>
    </div>
    <div itemprop="postalCode">37225</div>
    <div itemprop="addressCountry">usa</div>
  </div> <!-- /PostalAddress -->

</div> <!-- /SocialEvent -->

Now checking this markup, Google’s Testing Tool will report different errors for PostalAddress:

address: missing and required

name: missing and required

Field location may not be empty.

Adding a name to the PostalAddress item fixes the last two errors, so it leaves you with this strange error: "address: missing and required".

Strange, because PostalAddress can’t have an address property, as I’ve explained in an answer to a similar question on Stack Overflow. My guess: Google’s Testing Tool is bugged.

  • I was wondering if it might be bugged. On a hunch I tried several tools that build examples to test. All of them failed the same test. If nobody else comes up with a brilliant answer in the day, you win. – Maelish Apr 10 '15 at 23:41
2

From what I found, Google Structured Data Validation tool doesn't allow you to use PostalAddress for 'location' despite it being allowed by the schema. In here https://schema.org/location it's specifically said that 'location' can be either Place or PostalAddress.

Given that the Place have attributes 'address' and 'name' and GSDVT is asking for them despite the location being the type PostalAddress I think it's safe to say that it's a bug. If this is not allowed, then the error should be "location cannot be of type PostalAddress". If you actually add 'address' to the type of PostalAddress, GSDVT will make a complain about that one too.

Also, it makes sense to have events that don't have named places of happening.

2

Although it says on schema.org that Event.location can be either Place or PostalAddress, the google documentation says otherwise.

Event.location is required and has to be a Place

location: Place, required

A nested schema.org/Place (or more specific subtype, such as schema.org/EventVenue or schema.org/PerformingArtsTheater).

Event.location.address is also required and has to be a PostalAddress

address: PostalAddress, required

The venue's address. You may either provide the whole address as a single string, or provide the separate fields of the address in a nested schema.org/PostalAddress.

So going by your example, the proper format should be (Which currently validates without any red text on Google testing tool):

<div itemscope itemtype="http://schema.org/SocialEvent">
    <a itemprop="url" href="www.convention-name.org">
        <div itemprop="name"><strong>Bob's Convention</strong></div>
    </a>
    <div itemprop="description">blah blah blah blah blah</div>
    <div>
        <meta itemprop="startDate" content="2015-05-01:00.000">
        Starts: 2015-05-01:00.000
    </div>
    <meta itemprop="endDate" content="2015-05-02:00.000">
    Ends: 2015-05-02:00.000

    <div itemprop="location" itemscope itemtype="http://schema.org/Place">
      <div itemprop="name">Unknown Venue</div>
      <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
          <div itemprop="streetAddress">55 street</div>
          <div><span itemprop="addressLocality">Nashville</span>, <span itemprop="addressRegion">TN</span></div>
          <div itemprop="postalCode">37225</div>
          <div itemprop="addressCountry">usa</div>
      </div>
  </div>
</div>
  • Hmm, good to know. I might have to do something else since in most cases, I only have the postal code of the event. – Maelish Jun 28 '16 at 12:12
  • 1
    You can geocode the postcode to get the full address saved into a "Location" type field. Check out the location.module – Beebee Jun 28 '16 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.