Microdata/Schema.org/SEO:如何正确设置ContactPoint [英] Microdata/Schema.org/SEO: How to properly set a ContactPoint
问题描述
将微数据添加到页面后,我通常会转到: https://developers.google.com/webmasters/structured-data/testing-tool/进行测试并确保没有任何遗漏.
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.
我遇到以下错误:
"ContactPoint必须附加到声明类型的父级上"
我不确定我缺少什么...?
I am not sure what I am missing...?
示例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>
推荐答案
(尽管Google的测试工具将其报告为错误,但这不是实际的错误.应改为警告.您的代码是有效的微数据,并且您正确使用了Schema.org词汇.)
(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.)
-
您有两个顶级项目(一个
Person
和一个ContactPoint
),即它们没有任何关联.
You have two top-level items (a
Person
and aContactPoint
), i.e., they are not related in any way.
如果您想说 ContactPoint
是 Person
的联系点,那么您需要一个属性来连接这两项(HTML-层级嵌套与此处无关).
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).
查看 Person
的已定义属性,您可以找到 contactPoint
属性,该属性以 ContactPoint
作为值,并且定义为:
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.
将 contactPoint
属性添加到 Person
项,并引用 ContactPoint
项:
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>
这篇关于Microdata/Schema.org/SEO:如何正确设置ContactPoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!