Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1015503 of itemid

  • Revision slug: Web/HTML/Global_attributes/itemid
  • Revision title: itemid
  • Revision id: 1015503
  • Created:
  • Creator: duncanmcdonald
  • Is current revision? No
  • Comment Added LiveSample

Revision Content

Summary

The Itemid attribute is the unique, global identifier of an item. The global identifier of an item is the value of its element's itemid attribute, if it has one, parsed relative to the node document of the element on which the attribute is specified. If the itemid attribute is missing or if resolving it fails, it is said to have no global identifier.

The itemid attribute can only be specified on elements that  have both an itemscope attribute and an itemtype attribute specified. Additionally, an itemid can only be specified on elements with an itemscope attribute whose itemtype attribute specifies a vocabulary that supports global identifiers for items.

The exact meaning of a global identifier is determined by the vocabulary's specification. It is up to such specifications to define whether multiple items with the same global identifier (whether on the same page or on different pages) are allowed to exist, and what the processing rules for that vocabulary are with respect to handling the case of multiple items with the same ID.

Note: The Whatwg.org definition of an itemid says that it must be a URL. This does not seem to be the case as the example below shows. Rather the defacto definition is that an itemid is a unique identifier, so a URN is appropriate. This inconsistency no doubt reflects the incomplete nature of the Microdata specification.

sEditExample

HTML

<dl itemscope
    itemtype="https://vocab.example.net/book"
    itemid="urn:isbn:0-330-34032-8">
<dt>Title <dd itemprop="title">The Reality Dysfunction
<dt>Author <dd itemprop="author">Peter F. Hamilton
<dt>Publication date
<dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time> </dl>

Structured data

itemscope itemtype: itemid
https://vocab.example.net/book: urn:isbn:0-330-34032-8
itemprop title The Reality Dysfunction
itemprop author
Peter F. Hamilton
itemprop pubdate 1996-01-26

Result

{{ EmbedLiveSample('HTML', '', '', '', 'Web/HTML/Global_attributes/itemid') }}

Specifications

Specification Status
itemid WG Note - No longer being actively developed

Revision Source

<h2 id="Summary">Summary</h2>

<p>The <strong>Itemid </strong>attribute is the unique, global identifier of an item. The global identifier of an item is the value of its element's itemid attribute, if it has one, parsed relative to the node document of the element on which the attribute is specified. If the itemid attribute is missing or if resolving it fails, it is said to have no global identifier.</p>

<p>The itemid attribute can only be specified on elements that&nbsp; have both an <strong>itemscope </strong>attribute and an <strong>itemtype </strong>attribute specified. Additionally, an itemid can only be specified on elements with an itemscope attribute whose itemtype attribute specifies a vocabulary that supports global identifiers for items.</p>

<p>The exact meaning of a global identifier is determined by the vocabulary's specification. It is up to such specifications to define whether multiple items with the same global identifier (whether on the same page or on different pages) are allowed to exist, and what the processing rules for that vocabulary are with respect to handling the case of multiple items with the same ID.</p>

<p class="note"><strong>Note:</strong> The Whatwg.org definition of an itemid says that it must be a URL. This does not seem to be the case as the example below shows. Rather the defacto definition is that an itemid is a unique identifier, so a URN is appropriate. This inconsistency no doubt reflects the incomplete nature of the Microdata specification.</p>

<h2 id="sEditExample"><a class="button section-edit only-icon" href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-alternates$edit#Example"><span>sEdit</span></a>Example</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html">
&lt;dl itemscope
    itemtype="https://vocab.example.net/book"
    itemid="urn:isbn:0-330-34032-8"&gt;
&lt;dt&gt;Title &lt;dd itemprop="title"&gt;The Reality Dysfunction
&lt;dt&gt;Author &lt;dd itemprop="author"&gt;Peter F. Hamilton
&lt;dt&gt;Publication date
&lt;dd&gt;&lt;time itemprop="pubdate" datetime="1996-01-26"&gt;26 January 1996&lt;/time&gt; &lt;/dl&gt;</pre>

<h3 id="Specifications">Structured data</h3>

<table class="standard-table">
 <tbody>
  <tr>
   <td colspan="1" rowspan="14">itemscope</td>
   <td>itemtype: itemid</td>
   <td colspan="2" rowspan="1">
    <div class="jyrRxf-eEDwDf jcd3Mb IZ65Hb-hUbt4d"><span>https://vocab.example.net/book</span>: urn:isbn:0-330-34032-8</div>
   </td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>title</span></td>
   <td><span>The Reality Dysfunction</span></td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>author</span></td>
   <td>
    <div class="jyrRxf-eEDwDf jcd3Mb"><span>Peter F. Hamilton</span></div>
   </td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>pubdate</span></td>
   <td><span>1996-01-26</span></td>
  </tr>
 </tbody>
</table>

<h3>Result</h3>

<p>{{ EmbedLiveSample('HTML', '', '', '', 'Web/HTML/Global_attributes/itemid') }}</p>

<h2>Specifications</h2>

<table class="standard-table" style="height:105px; width:490px">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><a href="https://html.spec.whatwg.org/multipage/microdata.html#attr-itemid">itemid</a></td>
   <td>WG Note - No longer being actively developed</td>
  </tr>
 </tbody>
</table>
Revert to this revision