Tim*_*nen 66 html html5 microdata schema.org
我已经在互联网和stackoverflow上搜索了很长时间来回答这个问题,我发现链接表明你不应该把meta标签放在正文中:
schema.org网站清楚地显示了元标记直接嵌套在主体http://schema.org/AggregateRating中
只需看看那里发布的示例
Customer reviews:
<div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
<span itemprop="name">Not a happy camper</span> -
by <span itemprop="author">Ellie</span>,
<meta itemprop="datePublished" content="2011-04-01">April 1, 2011
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content = "1">
<span itemprop="ratingValue">1</span>/
<span itemprop="bestRating">5</span>stars
</div>
<span itemprop="description">The lamp burned out and now I have to replace
it. </span>
</div>
<div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
<span itemprop="name">Value purchase</span> -
by <span itemprop="author">Lucas</span>,
<meta itemprop="datePublished" content="2011-03-25">March 25, 2011
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content = "1"/>
<span itemprop="ratingValue">4</span>/
<span itemprop="bestRating">5</span>stars
</div>
<span itemprop="description">Great microwave for the price. It is small and
fits in my apartment.</span>
</div>
Run Code Online (Sandbox Code Playgroud)
如果你要保留meta标签<head>,那么你如何将这两个日期与他们的评论联系起来呢?
<meta itemprop="datePublished" content="2011-04-01">
<meta itemprop="datePublished" content="2011-03-25">
这引起了混乱,我想知道如何正确地做到这一点.
uno*_*nor 78
如果一个meta元素
itemprop属性和一个content属性,和name属性,没有http-equiv属性,没有charset属性,然后将它meta放入其中是有效的body.(如果该值是一个网址,你必须使用link代替.)
为什么?因为Microdata规范改变了HTML5.
(请注意,RDFa的也允许改变HTML5 meta在body某些情况下).
如果你要保留
meta标签<head>,那么你如何将这两个日期与他们的评论联系起来?
您可以使用以下itemref属性:
<!DOCTYPE html>
<html>
<head>
<title>Using itemref for meta in the head</title>
<meta itemprop="datePublished" content="2011-03-25" id="date">
</head>
<body>
<div itemscope itemtype="http://schema.org/Review" itemref="date">
<span itemprop="name">…</span>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
itemref采用以空格分隔的id值列表,因此您甚至可以引用两个或更多元素.只需将应添加到项目中id的所有元素(包含itemprop属性)添加到其itemref属性中,例如:itemref="date author rating".
还要记住,可以完全避免使用HTML标记并使用完全包含在 HTML文档中任何位置的 JSON-LD标记(甚至动态注入!),如下所示:<head>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Restaurant",
"name": "Fondue for Fun and Fantasy",
"description": "Fantastic and fun for all your cheesy occasions",
"openingHours": "Mo,Tu,We,Th,Fr,Sa,Su 11:30-23:00",
"telephone": "+155501003333",
"menu": "http://example.com/menu"
}
</script>
Run Code Online (Sandbox Code Playgroud)
看看schema.org中的示例,它们通常包含像https://schema.org/Restaurant这样的JSON示例标记.
这是另一篇关于它的好文章http://www.seoskeptic.com/json-ld-google-knowledge-graph-schema-org-seo/
我可以从whatwg.org上读到它在正文中使用是正确的:http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-meta-element
我在blogg的主体中使用meta标签来指定"datePublished"和"dateUpdated"属性.Googles Rich Snippets测试工具告诉我它是正确的,w3c验证代码.
我这样做:
<meta id="md_course" itemprop="course" name="course" content="..."/>
<meta id="md_lang" itemprop="language" content="eng"/>
<title id="md_title" itemprop="title" >Motivation and Course Overview</title>
</head>
<body itemscope itemtype=".../Presentation" itemref="md_course md_lang md_title md_field">
Run Code Online (Sandbox Code Playgroud)
您可以使用:
<meta itemprop="">
Run Code Online (Sandbox Code Playgroud)
即使您不想在页面上显示实际的文本(例如产品名称),也可以在页面的正文中执行schema.org语义标记,该标记是机器可读的(例如,对于机器人来说,对于SEO来说,是机器可读的)。
请参阅:http : //schema.org/docs/gs.html#advanced_missing
有时,网页上的信息可能会很有价值,但由于其在页面上的显示方式而无法进行标记。该信息可以在图像(例如,用于表示5中的4的评级的图像)或Flash对象(例如,视频剪辑的持续时间)中传达,或者可以隐含但不明确指出在页面上(例如,价格的货币)。
| 归档时间: |
|
| 查看次数: |
50070 次 |
| 最近记录: |