Microdata/Schema.org/SEO: How to properly set a ContactPoint

拈花ヽ惹草 提交于 2019-12-10 15:31:24

问题


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>

回答1:


(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>
    


来源:https://stackoverflow.com/questions/28334366/microdata-schema-org-seo-how-to-properly-set-a-contactpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!