问题描述
现在,我正在将itemprop
与Facebook Open Graph <meta>
标记结合使用,如下所示:
Right now I'm using itemprop
COMBINED with Facebook Open Graph <meta>
tags like the following:
<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"/>
这是可以接受的/有效的吗?
Is this acceptable/valid to do?
推荐答案
itemprop
由Microdata定义,property
由RDFa定义.因此,您的问题是:微数据和RDFa可以用于同一meta
元素吗?
itemprop
is defined by Microdata, property
is defined by RDFa. So your question is: Can Microdata and RDFa be used on the same meta
element?
是,因为我有解释了类似(但不完全相同)的问题:
在meta
上使用微数据时,不允许以下属性:name
,http-equiv
,charset
.在meta
上使用RDFa时,这三个属性是可选的.在这两种情况下,content
属性都是必需的.
When using Microdata on meta
, the following attributes are not allowed: name
, http-equiv
, charset
. When using RDFa on meta
, these three attributes are optional. In both cases the content
attribute is required.
请注意,您可以停止使用Microdata,也可以对Schema.org使用RDFa:
Note that you could stop using Microdata and use RDFa also for 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"/>
还请注意,当值是URL时,应使用link
而不是meta
:
Also note that you should use link
instead of meta
when the value is a 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"/>
这篇关于在Facebook OG元标记上使用Schema.org itemprop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!