验证错误:“已指定itemprop属性,但该元素不是任何项目的属性"; [英] Validation error: "The itemprop attribute was specified, but the element is not a property of any item"
问题描述
为了获得更好的SEO,我需要在页面上放置一些元数据,如下所示:
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
然后我在标记验证服务上检查以下代码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
<meta charset="UTF-8">
<title>My title</title>
</head>
<body>
My body.
</body>
</html>
引发此错误:
第4行,第57列:已指定
itemprop
属性,但该元素不是任何项目的属性.<meta itemprop="name" content="The Name or Title Here">
第5行,第70列:已指定
itemprop
属性,但该元素不是任何项目的属性.<meta itemprop="description" content="This is the page description">
第6行,第68列:已指定
itemprop
属性,但该元素不是任何项目的属性.<meta itemprop="image" content="http://www.example.com/image.jpg">
我该如何解决?
您应明确提供这些属性(name
,description
,image
)所属的类型.>
在Schema.org中,所有内容都是 Thing
. Thing
有许多子类型,在更多特定类型"下列出.从此处开始,然后为您的内容选择最具体的类型.
例如: WebPage
, Article
或 BlogPosting
.
它看起来像(这里以WebPage
为例)
<html itemscope itemtype="http://schema.org/WebPage">
For better SEO I need put some meta on my page like this:
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
Then I check this code on Markup Validation Service:
<!DOCTYPE html>
<html>
<head lang="en">
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
<meta charset="UTF-8">
<title>My title</title>
</head>
<body>
My body.
</body>
</html>
Throwing this error:
Line 4, Column 57: The
itemprop
attribute was specified, but the element is not a property of any item.<meta itemprop="name" content="The Name or Title Here">
Line 5, Column 70: The
itemprop
attribute was specified, but the element is not a property of any item.<meta itemprop="description" content="This is the page description">
Line 6, Column 68: The
itemprop
attribute was specified, but the element is not a property of any item.<meta itemprop="image" content="http://www.example.com/image.jpg">
How can I fix this?
You should explicitly provide a type these properties (name
, description
, image
) belong to.
In Schema.org, everything is a Thing
. Thing
has many child types, listed under "More specific Types". Start there and choose the most specific type for your content.
For example: WebPage
, Article
or maybe BlogPosting
.
It could look like (using WebPage
as example here):
<html itemscope itemtype="http://schema.org/WebPage">
这篇关于验证错误:“已指定itemprop属性,但该元素不是任何项目的属性";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!