加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 是否可以为opengraph和schema.org使用相同的元标记

发布时间:2020-12-14 18:27:41 所属栏目:资源 来源:网络整理
导读:我不喜欢文档头部的标签数量. 这是一些元标记的示例. !--w3c-- titlePage Title/titlemeta name="description" content="great description"!--schema.org--meta itemprop="name" content="Page Title"meta itemprop="description" content="great descripti
我不喜欢文档头部的标签数量.
这是一些元标记的示例.
<!--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”>页面标题< / title>
itemprop属性可以在任何地方使用,所以我很确定这很好
但据我所知,property =“og:*”属性必须与元标记一起使用.
那么以下标记是否可以接受?

<meta name="description" itemprop="description" property="og:description" content="great description">

这将如何影响SEO?

非常感谢

解决方法

HTML RDFa 1.1和Microdata extend HTML5的元元素.

HTML+RDFa 1.1 (W3C Recommendation)定义:

If the RDFa @property attribute is present on the meta element,neither the @name,@http-equiv,nor @charset attributes are required and the @content attribute MUST be specified.

Microdata (W3C Note)定义:

If a meta element has an itemprop attribute,the name,http-equiv,and charset attributes must be omitted,and the content attribute must be present.

这意味着:

>不允许将Microdata的itemprop属性与HTML5的name属性一起使用.
>允许将RDFa的属性属性与HTML5的name属性一起使用:

<meta name="description" property="og:description" content="great description" />

(possibly an issue在体内代替头部)
>如果没有提供HTML5的name属性,似乎允许使用Microdata的itemprop属性和RDFa的属性属性:

<meta itemprop="description" property="og:description" content="great description" />

(但W3C Nu Html Checker报告错误)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读