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 1015719 of itemid

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

Revision Content

Summary

The Itemid attribute is the unique, global identifier of an item.

Itemid attributes can only be specified on elements that  have both itemscope and itemtype attributes. Also, the itemid can only be specified on elements with an itemscope attribute whose corresponding itemtype refers to or defines a vocabulary that supports global identifiers.

An itemtype's vocabulary will give the exact meaning of a global identifier defined within the vocabulary. The vocabulary will define whether several items with the same global identifier can co-exist and, if they are allowed, how items with the same identifier are handled.

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.</p>

<p>Itemid attributes can only be specified on elements that&nbsp; have both <strong>itemscope </strong>and <strong>itemtype </strong>attributes. Also, the itemid can only be specified on elements with an itemscope attribute whose corresponding itemtype refers to or defines a vocabulary that supports global identifiers.</p>

<p>An itemtype's vocabulary will give the exact meaning of a global identifier defined within the vocabulary. The vocabulary will define whether several items with the same global identifier can co-exist and, if they are allowed, how items with the same identifier are handled.</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="Structured_data">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 id="Result">Result</h3>

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

<h2 id="Specifications">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