itemtype with http or better https?

蹲街弑〆低调 提交于 2020-01-11 12:13:12

问题


I use like:

itemtype="http://schema.org/ImageObject"

but the request http://schema.org/ImageObject will be forwarded to https://schema.org/ImageObject.

If I change to itemtype="https://schema.org/ImageObject", the Google SDTT shows no problem, but nearly all examples about structured data from Google are with http.

What is best or recommended to use http://schema.org or https://schema.org for itemtype?


回答1:


From Schema.org’s FAQs:

Q: Should we write https://schema.org or http://schema.org in our markup?

There is a general trend towards using https more widely, and you can already write https://schema.org in your structured data. Over time we will migrate the schema.org site itself towards using https: as the default version of the site and our preferred form in examples. However http://schema.org -based URLs in structured data markup will remain widely understood for the forseeable future and there should be no urgency about migrating existing data. This is a lengthy way of saying that both https://schema.org and http://schema.org are fine.

tl;dr: Both variants are possible.

The purpose of itemtype URIs

Note that the URIs used for itemtype are primarily identifiers, they typically don’t get dereferenced:

  • If a Microdata consumer doesn’t know what the URI in itemtype="http://schema.org/ImageObject" stands for, this consumer "must not automatically dereference" it.

  • If a Microdata consumer does know what the URI stands for, this consumer has no need to dereference this URI in the first place.

So, there is no technical reason to prefer the HTTPS variant. User agents won’t dereference this URI (in contrast to URIs specified in href/src attributes), and users can’t click on it. I think there is only one case where the HTTPS variant is useful: if a visitor looks into the source code and copy-pastes the URI to check what the type is about.

I would recommend to stick with the HTTP variant until Schema.org switched everything to HTTPS, most importantly the URI in RDF’a initial context.




回答2:


The specification of Schema for the type ImageObject indicated:

Canonical URL: http://schema.org/ImageObject

It is probably useful to refer to the canonical URL because it is the “preferred” version of the web page.



来源:https://stackoverflow.com/questions/55242400/itemtype-with-http-or-better-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!