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 14:00:27 -0400
Message-ID: <CAGR+nnFJQk4b_Rvng0VN3pJqWbEOLyZJx=vOwVUU8yRutTmFUA@mail.gmail.com>
Hi Tantek,

On Wed, Aug 24, 2011 at 1:30 PM, Tantek ?elik <tantek at cs.stanford.edu>wrote:

> On Wed, Aug 24, 2011 at 10:22, St?phane Corlosquet
> <scorlosquet at gmail.com> wrote:
> > 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>.
> >> > ]]]
>
> St?phane, this looks like an incomplete example - how does a parser
> know where the object that has name and url property starts and ends,
> is it the whole page? The nearest common ancestor element? AKA how
> does a parser determine the scope of the object?


> And are "name" and "url" intended to be page-specific properties, or
> do they belong to a theoretical shared vocabulary?
>
> Could you provide a complete RDFa example of what you're attempting to
> accomplish?
>

I purposely left out the context markup here as I was more interested in the
a element. But here is the RDFa markup. I'm not overloading it with other
attribute such as the title of the book for keeping the example small.
[[[
<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>
]]]



>
>
> >> > 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.
>
> One person (parser developer's) simple, is another person's (web
> author/designer/publisher) odd new strange way, and thus far from
> "simple". It's a trade-off rather than being "simple" in any absolute
> terms.
>
>
> >>  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.
>
> This does seem to be a (fairly common) case where microdata requires
> additional markup (another element) whereas both microformats (e.g.
> hCard) and microdata (through the perhaps questionable overloading of
> 'rel') do not.
>

I think you meant RDFa here.

Steph.


>
> St?phane, if you could provide a "complete" RDFa example of the
> content example you gave, I'd like to see what Tab (or anyone else)
> sees as an "ideal" way to mark it up with microdata instead for
> comparison purposes.
>
> Thanks,
>
> Tantek
>
> --
> http://tantek.com/ - I made an HTML5 tutorial! http://tantek.com/html5
>
Received on Wednesday, 24 August 2011 11:00:27 UTC

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