itemid

itemid 全局属性 以项目的唯一全局标识符的形式提供微数据。

¥The itemid global attribute provides microdata in the form of a unique, global identifier of an item.

只能为同时具有 itemscopeitemtype 属性的元素指定 itemid 属性。此外,itemid 只能在拥有 itemscope 属性的元素上指定,该属性对应的 itemtype 引用或定义支持全局标识符的词汇表。

¥An itemid attribute can only be specified for an element that has both itemscope and itemtype attributes. Also, itemid can only be specified on elements that possess an itemscope attribute whose corresponding itemtype refers to or defines a vocabulary that supports global identifiers.

itemtype 的全局标识符的确切含义由指定词汇表中该标识符的定义提供。词汇表定义具有相同全局标识符的多个项目是否可以共存,如果可以共存,则如何处理具有相同标识符的项目。

¥The exact meaning of an itemtype's global identifier is provided by the definition of that identifier within the specified vocabulary. The vocabulary defines whether several items with the same global identifier can coexist and, if so, how items with the same identifier are handled.

注意:WHATWG 定义指定 itemid 必须是 URL。然而,以下示例正确地说明了也可以使用 URN。这种不一致可能反映了微数据规范的不完整性质。

¥Note: The WHATWG definition specifies that an itemid must be a URL. However, the following example correctly illustrates that a URN may also be used. This inconsistency may reflect the incomplete nature of the Microdata specification.

示例

¥Examples

表示一本书的结构化数据

¥Representing structured data for a book

此示例使用微数据属性来表示以下结构化数据:

¥This example uses microdata attributes to represent the following structured data:

itemscope 物品种类:itemid [https://schema.org/Book](https://schema.org/Book):瓮:isbn:0-374-22848-5
itemprop title 东方冰之猫头鹰
itemprop author 乔纳森·C·斯拉特
itemprop datePublished 2020-08-04

HTML

html
<dl
  itemscope
  itemtype="https://schema.org/Book"
  itemid="urn:isbn:0-374-22848-5<">
  <dt>Title</dt>
  <dd itemprop="title">Owls of the Eastern Ice</dd>
  <dt>Author</dt>
  <dd itemprop="author">Jonathan C Slaght</dd>
  <dt>Publication date</dt>
  <dd>
    <time itemprop="datePublished" datetime="2020-08-04">August 4 2020</time>
  </dd>
</dl>

结果

¥Result

规范

Specification
HTML Standard
# attr-itemid

¥Specifications

也可以看看

¥See also