rpa*_*anm 23 seo w3c-validation meta-tags microdata schema.org
为了更好的搜索引擎优化,我需要在我的页面上添加一些元素:
<!-- 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">
Run Code Online (Sandbox Code Playgroud)
这是来源.
然后我在标记验证服务上检查此代码:
<!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>
Run Code Online (Sandbox Code Playgroud)
抛出这个错误:
第4行,第57列:
itemprop
指定了属性,但该元素不是任何项的属性.Run Code Online (Sandbox Code Playgroud)<meta itemprop="name" content="The Name or Title Here">
第5行,第70列:
itemprop
指定了属性,但该元素不是任何项的属性.Run Code Online (Sandbox Code Playgroud)<meta itemprop="description" content="This is the page description">
第6行,第68列:
itemprop
指定了属性,但该元素不是任何项的属性.Run Code Online (Sandbox Code Playgroud)<meta itemprop="image" content="http://www.example.com/image.jpg">
我怎样才能解决这个问题?
uno*_*nor 29
你应该明确地提供一个类型,这些属性(name
,description
,image
)属于.
在Schema.org中,一切都是Thing
.Thing
有许多子类型,列在"更具体的类型"下.从那里开始,为您的内容选择最具体的类型.
例如:WebPage
,Article
或可能BlogPosting
.
它看起来像(WebPage
在这里使用例子):
<html itemscope itemtype="http://schema.org/WebPage">
Run Code Online (Sandbox Code Playgroud)