现在我正在使用itemprop
与 Facebook 开放图谱相结合<meta>
标签如下:
<html class="no-js" itemscope="itemscope" itemtype="http://schema.org/WebPage">
// ...
<meta property="og:type" content="website" />
<meta itemprop="name" property="og:title" content="My Title" />
<meta itemprop="image" property="og:image" content="http://example.com/socialimage.jpg" />
<meta itemprop="url" property="og:url" content="http://example.com" />
<meta itemprop="description" property="og:description" content="My description" />
<meta property="og:site_name" content="My Site"/>
这是可以接受的/有效的做法吗?
itemprop
由微数据定义,property
由 RDFa 定义。所以你的问题是:Microdata和RDFa可以同时使用吗meta
元素?
Yes,正如我所拥有的在类似(但不相同)的问题中解释 https://stackoverflow.com/a/20429551/1591669:
当使用微数据时meta
,不允许使用以下属性:name
, http-equiv
, charset
。当使用 RDFa 时meta
,这三个属性是可选的。在这两种情况下content
属性是必需的。
请注意,您也可以停止使用 Microdata 并使用 RDFa 来处理 Schema.org:
<html typeof="schema:WebPage">
<!-- … -->
<meta property="og:type" content="website" />
<meta property="og:title schema:name" content="My Title" />
<meta property="og:image schema:image" content="http://example.com/socialimage.jpg" />
<meta property="og:url schema:url" content="http://example.com" />
<meta property="og:description schema:description" content="My description" />
<meta property="og:site_name" content="My Site"/>
另请注意,您应该使用link
代替meta
当值为 URL 时:
<meta property="og:type" content="website" />
<meta property="og:title schema:name" content="My Title" />
<link property="og:image schema:image" href="http://example.com/socialimage.jpg" />
<link property="og:url schema:url" href="http://example.com" />
<meta property="og:description schema:description" content="My description" />
<meta property="og:site_name" content="My Site"/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)