【问题标题】:Microdata/Schema.org/SEO: How to properly set a ContactPointMicrodata/Schema.org/SEO:如何正确设置 ContactPoint
【发布时间】:2015-02-05 00:49:25
【问题描述】:

将微数据添加到页面后,我通常会去:https://developers.google.com/webmasters/structured-data/testing-tool/ 进行测试并确保没有遗漏任何内容。

我收到以下错误:

“ContactPoint 必须附加到具有声明类型的父级”

我不确定我错过了什么...?

示例 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>

【问题讨论】:

    标签: html seo schema.org microdata


    【解决方案1】:

    (虽然 Google 的测试工具将此报告为 错误,但这并不是实际错误。它应该是一个警告。您的代码是有效的微数据,并且您正确使用了 Schema.org 词汇表。 )

    1. 您有两个顶级项目(PersonContactPoint),即它们没有任何关系。

    2. 如果你想说ContactPointPerson的联系点,那么你需要一个属性来连接这两个项目(这里不涉及HTML级别的嵌套)。

    3. 查看Person的定义属性,可以找到contactPoint property,它以ContactPoint为值,定义为:

      个人或组织的联系点。

      所以这个属性适合你的情况。

    4. contactPoint 属性添加到Person 项,引用ContactPoint 项:

      <div itemscope itemtype="http://schema.org/Person">
        …
        <p itemprop="contactPoint" itemscope itemtype="http://schema.org/ContactPoint">
        …
        </p>
      </div>
      

    【讨论】:

    • 它工作了,但现在它给了我另一个错误 >_<....:>The value provided for webmaster must be a valid contact type. 在 schema.org 对schema.org/contactType 的定义中是文本。所以我的印象是任何价值都会发生......为什么会出错?
    • @Omar:是的,就 Schema.org 而言,任何文本值都可以。但是,Google 在此之上还有其他规则:该值应该是 listed values 之一。同样,这只是特定于 Google 的 Rich Snippet 解析的规则。不提供这样的值是完全有效的,那么您可能就不会得到 Google Rich Snippet。
    • @Omar:如果您不是特别关心 Google,但想验证您的 Microdata/Schema.org,您可能应该使用不同的工具,因为 Google 的测试工具总是报告 Google 特定的问题。例如,请参阅问题Online Microdata parser
    • Google 似乎对这篇文章感到羞愧,COMPLETE 更改了 listed values 的内容,而是创建了一个新页面 corporate contacts 提及 ...其他联系人类型可能是稍后支持.. 调低自己的要求来控制contactType的值
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 2016-03-18
    相关资源
    最近更新 更多