简体   繁体   English

我们可以在微数据模式的标签上添加 itemscope 和 itemtype 吗?

[英]Can we add itemscope & itemtype on <HTML> tag for microdata schema?

<html lang="en" itemscope itemtype="http://schema.org/ApartmentComplex">
   ---
   ---
   ---
</html>

Is it a good practice to add itemscope on <html> tag?<html>标签上添加 itemscope 是一个好习惯吗?

I would personally avoid doing that unless it was for a WebPage entity or subtype.我个人会避免这样做,除非它是针对 WebPage 实体或子类型的。 Scoping the whole document for a type like that would make it hard to add other entities to the page.将整个文档的范围限定为这样的类型会使向页面添加其他实体变得困难。 eg BreadcrumbList例如面包屑列表

Absolutely you can add any type on the root <html> element.绝对可以在根<html>元素上添加任何类型。

And yeah @Tony's view is right that if you may ever in future or anyone else want to add up some more semantic markup and vocabulary, like BreadcrumbList type which can be linked to Webpage type, then <html> element would need a parent element which would not be possible in your case, therefore it would not be recommended.是的, @Tony's观点是正确的,如果您将来或任何其他人想要添加更多语义标记和词汇,例如可以链接到网页类型的BreadcrumbList类型,那么<html>元素将需要一个父元素在您的情况下是不可能的,因此不建议这样做。

Although there is another case , I've'nt practically used it, where Schema.org implicitly consider every web page as Webpage type(Search Engine's view) and therefore it would be certain to add up any type to the html page or to the root element as you did, without affecting the page's implicit WebPage type declaration.虽然还有另一种情况,但我没有实际使用它,其中Schema.org隐含地将每个 web 页面视为网页类型(搜索引擎的视图),因此肯定会将任何类型添加到 html 页面或root 元素,而不影响页面的隐式WebPage 类型声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM