1

The HTML Microdata Working Draft shows the following example:

Assuming a page at http://example.net/some/dataexample contains the following code:

<section itemscope itemtype="http://example.org/animals#cat">
 <h1 itemprop="name">Hedral</h1>
 <p itemprop="desc">Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.</p>
 <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
</section>

The item's type is "http://example.org/animals#cat"

In this example the "http://example.org/animals#cat" item has three properties:

http://example.org/animals#name
"Hedral"

http://example.org/animals#desc
Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.

http://example.org/animals#img
hedral.jpeg

I'm confused as to why the name property, resolves to http://example.org/animals#name?

I thought that Microdata used standard relative URL resolution for this purpose, in which case AFAIK it should be http://example.org/name.

Is this a documentation bug or is this behaviour documented somewhere?

1

itemprop isn’t a regular hyperlink attribute (like href or src). It can contain absolute URLs and/or strings, but not relative URLs.

If the value is a string, the property URL gets formed by appending this string to the vocabulary identifier.

This vocabulary identifier gets determined by the itemscope attribute. There are three cases:

  • If the itemscope value contains a #,
    the itemprop value will be appended after the first #.

  • If the itemscope value contains a / (and no #),
    the itemprop value will be appended after the last /.

  • If the itemscope value contains no # and no /,
    a / will be added and the itemprop value will be appended after this /.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.