如何在HTTPS页面上实现Schema.org? [英] How to implement Schema.org on HTTPS pages?

查看:268
本文介绍了如何在HTTPS页面上实现Schema.org?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTTPS页面上用HTTP值(http://schema.org/WebPage)静态设置Microdata的itemtype属性是否正确,还是在所有页面上都需要使用HTTPS值(https://schema.org/WebPage)?

Is it correct to statically set up Microdata’s itemtype attribute with HTTP value (http://schema.org/WebPage) on HTTPS pages or do I need to use HTTPS value (https://schema.org/WebPage) on all pages?

由于该站点的HTTP和HTTPS版本均可用,我可以将其设置为//schema.org/WebPage吗?

Since both HTTP and HTTPS versions of the site are available, can I set it up to //schema.org/WebPage or not?

推荐答案

tl; dr:使用http URI.

网站站长SE上的答案中,我解释了为什么您应该偏爱http而不是https架构.组织URI:http URI似乎是规范的,因为Schema.org词汇表的实际定义仅定义了http,而没有定义https.另外:所有示例(甚至在HTTPS上)都使用HTTP变体,作者提到他们更喜欢看到HTTP变体的使用,并且RDFa的Initial Context仅定义了HTTP变体(因此,大多数RDF领域将使用HTTP)

In this answer on Webmasters SE I explained why you should favor http over https Schema.org URIs: The http URIs seem to be canonical, as the actual definition of the Schema.org vocabulary only defines http, not https. In addition: all examples (even on HTTPS) use the HTTP variant, the authors mentioned that they prefer to see the use of the HTTP variant, and RDFa’s Initial Context defines the HTTP variant only (so most of the RDF world will use HTTP).

网站站长SE上的答案我解释了为什么不应该将相对于协议的URI用于词汇表:词汇表URI通常不会被取消引用,并且永远不会从词汇表中得到 embedded ,因此,绝对不需要使用HTTPS,因为您使用的是HTTPS(这类似于简单地链接到外部页面,甚至可能无法通过HTTPS访问该页面).最重要的是,如果通过不同于HTTP/HTTPS的协议访问文档,则Schema.org标记将不再起作用,并且某些解析器可能无法识别您正在使用Schema.org词汇表因为它们可能会在不为itemtype属性应用URI解析的情况下查找完整的URI.

In this answer on Webmasters SE I explained why you should not use protocol-relative URIs for vocabularies: Vocabulary URIs typically don’t get dereferenced, and there will never get something embedded from a vocabulary, so there is absolutely no need to use HTTPS for these just because you use HTTPS (it’s similar to simply linking to an external page, which might not even be accessible via HTTPS). On top of that, your Schema.org markup would no longer work if the document is accessed via a different protocol than HTTP/HTTPS, and it’s likely that some parsers won’t be able to recognize that you are using the Schema.org vocabulary because they might look for full URIs without applying URI resolution for the itemtype attribute.

这篇关于如何在HTTPS页面上实现Schema.org?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆