The RDFa markup for the number of comments in teaser mode is:
<div about="/node/12">
<ul>
<li>
<a content="4" property="sioc:num_replies" href="/node/12#comments">4 comments</a>
</li>
</ul>
</div>
I initially thought it would create the triple
</node/12> sioc:num_replies "4" .
but it turns out the RDFa parser I use generates
</node/12#comments> sioc:num_replies "4" .
What's happening is that the href URI is set as new subject because there are no rel/rev (due to the RDFa parsing rule 4). Our options are either to:
- add about="/node/12"
in the a tag
- add rel=""
in the a tag
Although it's less self explanatory, I would choose the empty rel which would perform slightly better - no value to check_plain() in drupal_attributes() - and generate a bit less extra markup (with appropriate documentation in rdf.module).
(see related thread on the RDFa mailing list).
Comment | File | Size | Author |
---|---|---|---|
#8 | rdf_694994_4.patch | 2.86 KB | Stefan Freudenberg |
#6 | rdf_694994_3.patch | 2.95 KB | Stefan Freudenberg |
#4 | rdf_694994_2.patch | 2.86 KB | Stefan Freudenberg |
#2 | rdf_694994.patch | 926 bytes | Stefan Freudenberg |
Comments
Comment #1
scor CreditAttribution: scor commentedtagging
Comment #2
Stefan Freudenberg CreditAttribution: Stefan Freudenberg commentedHere's a patch that adds the empty rel attribute to the comment count links.
Comment #3
scor CreditAttribution: scor commentedWe need a comment to explain why we need to add this empty rel, something like:
According to the RDFa processing rule #4 triggered the lack of @rel/@rev attribute, a new subject URI will be set from the @href value. We want to trigger rule #5 and for that reason set an empty @rel attribute. (with a link to http://www.w3.org/TR/rdfa-syntax/#sec_5.5.)
A test for that empty @rel will also be nice :)
Comment #4
Stefan Freudenberg CreditAttribution: Stefan Freudenberg commentedAdded a comment and a test.
Comment #5
Stefan Freudenberg CreditAttribution: Stefan Freudenberg commentedComment #6
Stefan Freudenberg CreditAttribution: Stefan Freudenberg commentedRemoved trailing whitespace.
Comment #7
scor CreditAttribution: scor commentedThis patch works. The test fail when the empty @rel hunk is not there, and works otherwise, so this is RTBC after some minor docs tweaks below (leaving needs review as this is minor).
a comma between "number 4" and "a new..." would improve the read flow.
parent container to be more explicit.
We don't put double space after the end of a sentence.
Comment #8
Stefan Freudenberg CreditAttribution: Stefan Freudenberg commentedModified the patch according to previous comment.
Comment #9
scor CreditAttribution: scor commentedthanks Stefan! RTBC as said in #7.
Comment #10
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.