我不喜欢文档头部的标签数量。 这是一些元标记的示例。
<!--w3c-->
<title>Page Title</title>
<meta name="description" content="great description">
<!--schema.org-->
<meta itemprop="name" content="Page Title">
<meta itemprop="description" content="great description">
<!-- opengraph-->
<meta property="og:title" content="Page Title">
<meta property="og:description" content="great description">
是否可以结合标签/属性来减少代码大小而不影响 SEO?
例如
<title itemprop="name">Page Title</title>
itemprop 属性可以在任何地方使用,所以我很确定这很好
但据我所知,property="og:*"属性必须与元标记一起使用。
那么下面的标记是否可以接受?
<meta name="description" itemprop="description" property="og:description" content="great description">
这将如何影响 SEO?
非常感谢
最佳答案
HTML+RDFa 1.1 和微数据 extend HTML5 的 meta
元素。
HTML+RDFa 1.1 (W3C Recommendation)定义:
If the RDFa
@property
attribute is present on themeta
element, neither the@name
,@http-equiv
, nor@charset
attributes are required and the@content
attribute MUST be specified.
If a
meta
element has anitemprop
attribute, thename
,http-equiv
, andcharset
attributes must be omitted, and thecontent
attribute must be present.
这意味着:
不允许将 Microdata 的
itemprop
属性与 HTML5 的name
属性一起使用。允许将 RDFa 的
property
属性与 HTML5 的name
属性一起使用:<meta name="description" property="og:description" content="great description" />
(possibly an issue 在
body
而不是head
中)如果未提供 HTML5 的
name
属性,似乎允许将 Microdata 的itemprop
属性与 RDFa 的property
属性一起使用:<meta itemprop="description" property="og:description" content="great description" />
(但是W3C Nu Html Checker报错)
关于html - 是否可以对 opengraph 和 schema.org 使用相同的元标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20401085/