W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] adding microdata to basic links

From: Stéphane Corlosquet <scorlosquet@gmail.com>
Date: Wed, 24 Aug 2011 13:22:11 -0400
Message-ID: <CAGR+nnHCPi2Aek1=DDKwY49GovVNLsZ3Dd6vRXtgxMWp4m+yyQ@mail.gmail.com>
On Wed, Aug 24, 2011 at 1:18 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> On Wed, Aug 24, 2011 at 10:02 AM, St?phane Corlosquet
> <scorlosquet at gmail.com> wrote:
> > Starting from a basic markup like this:
> > [[[
> > This book has been authored by <a href="http://smith.org/john">John
> > Smith</a>.
> > ]]]
> >
> > I would like to markup both the textContent of the link ("John Smith")
> and
> > the url from the href attribute.
> >
> > In RDFa this is done by adding a couple of attributes to the a element.
> It
> > would read like this:
> > [[[
> > This book has been authored by <a property="name" rel="url" href="
> > http://smith.org/john">John Smith</a>.
> > ]]]
> >
> > Is there any way to do the same in microdata without adding a new HTML
> > element to the markup?
>
> No, Microdata purposely keeps its data model simple by expressing
> property names through a single attribute.  Since having @itemprop on
> an <a> always refers to the @href of the element, you must nest an
> additional element, such as a <span>, into your markup to carry the
> property that refers to the text content.
>

Thanks for clarifying this, Tab.

Steph.


>
> ~TJ
>
Received on Wednesday, 24 August 2011 10:22:11 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:35 UTC