微数据
微数据是一种规范,用于在 HTML 文档中嵌入机器可读数据。微数据由根据词汇定义的名称-值对(称为 items
)组成。schema.org 提供了一系列常用的标记词汇。
基本语法包括用于定义项的 itemscope
属性,以及用于描述项的某个属性的 itemprop
属性。类型使用 itemtype
属性指定,可以采用所选词汇表中定义的值。例如,schema.org
定义了 http://schema.org/Person
或 http://schema.org/PostalAddress
等类型。
以下示例(来自 Wikipedia)展示了如何使用微数据描述人物:
<section itemscope itemtype="http://schema.org/Person">
Hello, my name is
<span itemprop="name">John Doe</span>,
I am a
<span itemprop="jobTitle">Graduate research assistant</span>
at the
<span itemprop="affiliation">University of Dreams</span>
My friends call me
<span itemprop="additionalName">Johnny</span>
You can visit my homepage at
<a href="http://www.example.com.com" itemprop="url">www.example.com</a>
<section itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
I live at
<span itemprop="streetAddress">1234 Peach Drive</span>
<span itemprop="addressLocality">Warner Robins</span>
<span itemprop="addressRegion">Georgia</span>.
</section>
</section>
请使用架构验证器工具调试代码,并根据支持的架构对其进行验证。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-21。
[null,null,["最后更新时间 (UTC):2024-12-21。"],[[["Microdata is an HTML specification used to embed machine-readable data in webpages using name-value pairs called `items` which are defined within a vocabulary."],["Schema.org provides commonly used vocabularies to structure the data, and items are marked up with attributes like `itemscope`, `itemprop`, and `itemtype` for machines to understand."],["The syntax involves defining an `item` and its `properties` using these attributes, and specifying a vocabulary such as schema.org for types like `Person` or `PostalAddress`."],["You can validate your Microdata implementation using the Schema Validator tool to ensure correctness and compatibility with supported schemas."]]],["Microdata embeds machine-readable data in HTML using name-value pairs called items. `itemscope` defines an item, `itemprop` describes its properties, and `itemtype` specifies its type from a vocabulary (e.g., schema.org). For example, the `Person` type can include properties like `name`, `jobTitle`, and `address`. The Schema Validator tool is available for debugging and validating microdata markup against supported schemas.\n"]]