本文介绍了为什么使用Schema.org微数据标记网页元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我理解为什么以及如何使用向您的网站添加微数据,这不是一个问题那。问题是为什么Schema.org支持某些可以用简单的HTML5标记的东西。其中包括



类型






  • 我可以看到为什么 WebPage WebSite ,但不需要使用此标记< html> 标签执行此操作。




  • 为什么不使用?




  • 只需使用。 p>




属性






  • 元素




  • 元素< head>



解决方案

这个答案主要是关于 WebPageElement 类型(如<$ c
$ b

对于 WebPage ,请参阅(tl;博士:它对我们有用provid e WebPage ,即使对于当前页面也是如此。



对于 WebSite ,与上面的答案类似的原因适用。 HTML不允许您陈述整个网站的相关内容(顺便说一下,Google Rich结果会使用此类型)。




Schema.org不限于HTML5。



Schema.org是,您可以指定无法用纯HTML5指定的元数据。例如, / / etc。表格。


  • 您可以使用这些类型来指定有关当前文档中不存在的内容的数据,例如,您可以在您的个人网站上说明你是维基百科中一个表的作者。




  • 这就是说,这些不是典型的用例广泛的作者。除非你有使用它们的具体原因,否则你可能想要省略它们。 它们对典型网站无用。在某些情况下使用它们 。



    另见我的Schema.org问题的用途,我建议弃用 WebPageElement mainContentOfPage c $ c>属性。


    I understand why and how to use Schema.org to add microdata to your site, this is not a question about that. The question is why Schema.org has support for certain things that can be marked up with simple HTML5. Among these are

    Types

    • WebPage and WebSite

      I can see why WebPage and WebSite would be needed, for example, to reference the page/site of a certain organization in a link, but there's no need to mark up your own page with this—the <html> tag does this.

    • SiteNavigationElement

      Why not just use <nav>?

    • Table

      Just use <table>.

    properties

    解决方案

    This answer is primarily about the WebPageElement types (like SiteNavigationElement).

    For WebPage, see my answer to the question Implicity of web page structure in Schema.org (tl;dr: it can be useful to provide WebPage, even for the current page).

    For WebSite, similar reasons from the answer above apply. HTML doesn’t allow you to state something about the whole site (and, by the way, a Google rich result makes use of this type).


    Schema.org is not restricted to HTML5.

    Schema.org is a vocabulary which can be used with various syntaxes (like JSON-LD, Microdata, RDFa, Turtle, …), stand-alone or in various host languages (like HTML 4.01, XHTML 1.0/1.1, (X)HTML5, XML, SVG, …). So having other ways to specify that something is (or: is about; or: represents) a site-wide navigation, a table etc. is the exception rather than the rule.

    But there can be reasons to use these types even in HTML5 documents, for example:

    • The HTML5 markup and the annotations from Microdata/RDFa are two "different worlds": a Microdata/RDFa parser is only interested in the annotations, and after successfully parsing a document, the underlying markup is of no relevance anymore (e.g., the information that something was specified in a table element is lost in the Microdata/RDFa layer).

    • By using types like WebPageElement, you can specify metadata that is not possible to specify in plain HTML5. For example, the author/license/etc. of a table.

    • You can use these types to specify data about something which does not exist on the current document, e.g., you could say on your personal website that you are the author of a table in Wikipedia.

    That said, these are not typical use cases relevant for a broad range of authors. Unless you have a specific reason for using them, you might want to omit them. They are not useful for typical websites. Using them can even be problematic in some cases.

    See also my Schema.org issue The purpose of WebPageElement and mainContentOfPage, where I suggested to deprecate WebPageElement and the mainContentOfPage property.

    这篇关于为什么使用Schema.org微数据标记网页元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    10-24 16:25