[html5] microdata itemref

Brian Tremblay webmaster at tsmchughs.com
Mon Dec 10 11:57:19 PST 2012

On 12/10/12 11:07 AM, Ian Hickson wrote:
> On Mon, 10 Dec 2012, Brian Tremblay wrote:
>> What I'm trying to do is associate "Napa Valley" in the <p> element with
>> the winery in the header, as that winery's addressRegion.
> If you mean the text, you need some additional markup because the <a>
> element in microdata only ever represents its URL, so e.g.:
>    <article itemscope itemtype="http://schema.org/FoodEvent">
>     <header>
>       <h1 itemprop="name">Franciscan Estate tasting</h1>
>       hosted by
>       <div itemprop="performer" itemscope itemtype="http://schema.org/Person">
>         <span itemprop="name">J. Kounellas</span>,
>         <span itemprop="worksFor" itemscope itemtype="http://schema.org/Winery"
>               itemref="wineryLocation">
>           <span itemprop="name">Franciscan Estate Winery</span>
>         </span>
>       </div>
>     </header>
>     <p itemprop="description">Join us for a special wine event featuring
>     <a href="http://en.wikipedia.org/wiki/Napa_Valley_AVA"
>      ><span id="wineryLocation" itemprop="addressRegion">Napa
>      Valley</span></a>'s Franciscan Estate Winery.
>     </p>
>    </article>

That generates an error from Google's rich snippet testing tool:

"Warning: Page contains property "addressregion" which is not part of 
the schema."

The microdata food event does not contain an addressRegion property.

I could change the markup so that the <span id="wineryRegion"> is a 
nested postalAddress itemtype, but that would associate the *event* with 
that address, which is wrong. "Napa Valley" is the location of the 
winery, not the event.

These are the problems I always run into.

> Basically, though, you just put the itemref="" on the element with
> itemscope="" and give it IDs of elements to include as if they were
> children of the element with itemscope="".

That is indeed what the spec says, but I can not get it to work. :-(

Brian Tremblay

More information about the Help mailing list