[whatwg] adding microdata to basic links

Stéphane Corlosquet scorlosquet at gmail.com
Wed Aug 24 13:20:47 PDT 2011


Hi Ted,

On Wed, Aug 24, 2011 at 3:53 PM, Edward O'Connor <eoconnor at apple.com> wrote:

> Tantek asked:
>
> >> Could you provide a complete RDFa example of what you're attempting to
> >> accomplish?
>
> Stéphane replied:
>
> > <p>
> > This book has been authored by
> >    <span vocab="http://schema.org/" typeof="Person">
> >        <a property="name" rel="url" href="http://smith.org/john">John
> > Smith</a>
> >    </span>
> > </p>
>
> This could be represented in Microdata without an extra element:
>
> <p itemscope>
> This book has been authored by
>     <span itemprop="name">
>        <a itemprop="url" href="http://smith.org/john">John
> Smith</a>
>    </span>
> </p>
>

Not the same. The span element in my example was used to assert a type,
which you repurposed for the name property. So no matter what, you need to
wrap the a element or its textContent with an extra span element for the
name property, e.g.

<p itemscope>
This book has been authored by
   <span itemscope itemtype="http://schema.org/Person">
       <span itemprop="name">
           <a itemprop="url" href="http://smith.org/john">John Smith</a>
       </span>
   </span>
</p>

Steph.


>
> Or in the hCard microformat with even less markup:
>
> <p class="vcard">
>    This book has been authored by <a class="fn url"
>     href="http://smith.org/john">John Smith</a>
> </p>
>
>
>
> HTH,
> Ted



More information about the whatwg mailing list