Search code examples
schema.orgrich-snippetsgoogle-rich-snippets

Can't validate Event rich snippet with PostalAddress and no Place


I'm defining a http://schema.org/Event for an "open house" tour of a residential home. The event's name is "Open House," but the location doesn't have a "name" (other than its address).

According to https://developers.google.com/structured-data/rich-snippets/events I ought to be able to use a PostalAddress for the location field of the snippet, perhaps like this:

<div itemscope itemtype="http://schema.org/Event">
  <div itemprop="name">Open House</div>
  <div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
    <div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
      <div>
        <span itemprop="streetAddress">123 Main St</span>,
        <span itemprop="addressLocality">San Francisco</span>,
        <span itemprop="addressRegion">CA</span>,
        <span itemprop="postalCode">94111</span>
      </div>
  </div>
</div>

But this fails in the Rich Snippet test tool. https://developers.google.com/structured-data/testing-tool/ It says that my location requires "name" and "address" properties.

That makes perfect sense if the location is a named Place, e.g. a restaurant or business venue. For example, this validates in the test tool:

<div itemscope itemtype="http://schema.org/Event">
  <div itemprop="name">Open House</div>
  <div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
  <div itemprop="location" itemscope itemtype="http://schema.org/Place">
    <div itemprop="name">WHAT DO I PUT HERE?!</div>
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
      <div>
        <span itemprop="streetAddress">123 Main St</span>,
        <span itemprop="addressLocality">San Francisco</span>,
        <span itemprop="addressRegion">CA</span>,
        <span itemprop="postalCode">94111</span></div>
    </div>
  </div>
</div>

The problem is, I have no idea what name to use for a residential home. It doesn't have a name, other than its address.

What's the right way to construct this snippet? Is Google's documentation incorrect? If the test tool is correct, do I have to name a nameless Place?


Solution

  • Right after posting my question, I realized that I could nest the address inside the name, making the name be equal to the address. The test tool accepts this. (But this feels wrong.)

    <div itemscope itemtype="http://schema.org/Event">
      <div itemprop="name">Open House</div>
      <div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
      <div itemprop="location" itemscope itemtype="http://schema.org/Place">
        <div itemprop="name">
          <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
            <div>
              <span itemprop="streetAddress">123 Main St</span>,
              <span itemprop="addressLocality">San Francisco</span>,
              <span itemprop="addressRegion">CA</span>,
              <span itemprop="postalCode">94111</span></div>
          </div>
        </div>
      </div>
    </div>