4

After adding microdata to a page, I usually go to: https://developers.google.com/webmasters/structured-data/testing-tool/ to test it out and to make sure there's nothing missing.

I am getting the following error:

"ContactPoint must be attached to a parent with a declared type"

I am not sure what I am missing...?

Sample HTML

<div itemscope itemtype="http://schema.org/Person">
    <p>
        <span itemprop="description">Webmaster</span>: 
        <span itemprop="name">Omar</span>
        <br/><a itemprop="url" href="https://plus.google.com/+Omar/">Profile</a>
    </p>

    <p itemscope itemtype="http://schema.org/ContactPoint">
        To contact me please email me at 
            <a itemprop="email" href="mailto:omar@somewhere.com">omar@somewhere.com</a>
            <meta itemprop="contactType" content="Webmaster"/>
            <meta itemprop="sameAs" content="https://plus.google.com/+OmarJuvera"/>
            <meta itemprop="availableLanguage" content="English"/>
            <meta itemprop="availableLanguage" content="Spanish"/>
            <meta itemprop="availableLanguage" content="Japanese"/>
    </p>
</div>
unor
  • 92,415
  • 26
  • 211
  • 360
Omar
  • 11,783
  • 21
  • 84
  • 114

1 Answers1

6

(While Google’s Testing Tool reports this as an error, it’s not an actual error. It should be a warning instead. Your code is valid Microdata and you are correctly using the Schema.org vocabulary.)

  1. You have two top-level items (a Person and a ContactPoint), i.e., they are not related in any way.

  2. If you want to say that the ContactPoint is the contact point for the Person, then you need a property to connect these two items (the HTML-level nesting is not relevant here).

  3. Looking at the defined properties for Person, you can find the contactPoint property, which takes a ContactPoint as value and is defined as:

    A contact point for a person or organization.

    So this property is appropriate for your case.

  4. Add the contactPoint property to the Person item, referencing the ContactPoint item:

    <div itemscope itemtype="http://schema.org/Person">
      …
      <p itemprop="contactPoint" itemscope itemtype="http://schema.org/ContactPoint">
      …
      </p>
    </div>
    
unor
  • 92,415
  • 26
  • 211
  • 360
  • it worked, but now it's giving me another error >_<....:`The value provided for webmaster must be a valid contact type.` In schema.org's definition for http://schema.org/contactType is text. So I am under the impression that any value goes...Why the error? – Omar Feb 10 '15 at 23:24
  • 1
    @Omar: Yes, any text value goes, as far as Schema.org is concerned. However, Google has additional rules on top of that: the value should be one of the [listed values](https://developers.google.com/webmasters/structured-data/customize/contact-points?&hl=en). Again, this is only a rule specific to Google’s Rich Snippet parsing. Not providing such a value is perfectly valid and fine, you might just don’t get a Google Rich Snippet then. – unor Feb 11 '15 at 12:48
  • 1
    @Omar: If you don’t especially care about Google, but want to validate your Microdata/Schema.org, you should probably use a different tool as Google’s Testing Tool always reports Google-specific issues. See, for example, the question [Online Microdata parser](http://softwarerecs.stackexchange.com/q/13674/60). – unor Feb 11 '15 at 12:51
  • It appears that Google got put to shame with this post, and COMPLETE changed the content of [listed values](https://developers.google.com/webmasters/structured-data/customize/contact-points?&hl=en) and instead created a new page [corporate contacts](https://developers.google.com/search/docs/data-types/corporate-contacts) mentioning _...Additional contact types may be supported later.._ to tone down on their own demands to control the values of `contactType` – Omar Dec 08 '16 at 18:20