Author: Claudia Wagner | Published: 15th January 2009 | RSS |  LINK

Few days ago I decided to write simple Wordpress Plugin, which annotates the content of the current page with RDFa and does not require to change the theme manually (except maybe the header.php).

First I thought the plugin will consist of few filter functions which filter the current theme and enrich some template tags (such as the_content(), the_title()) with RDFa annotations (e.g. the_content() tag should be substituted with <span about=”<?php the_permalink() ?>” property=”sioc:content”> the_content()</span> ).

In theory that was a good idea, but I didn’t consider that I must check in which context the template tags appear :). For example the_title() tag is often used in the <a> HTML tag to expose the link title. These title should of course not be enriched with RDFa.
It turned out to be impossible (or at least very difficult) to implement such a context aware filter function within a Wordpress Plugin.

So I had to change the strategy. As automatic generation of RDFa was not possible, I considered the possibility to do it manually. Gautier Poupeau describes here how to create manually RDFa annotations for WP themes.  Well, the first disadvantage of manually creating RDFa is of course that people will not do it and need certain knowledge about RDFa to be able to do it. Furthermore making all these annotations manually seems to be a very error-prone process. I also wondered how many information should be annotated with RDFa? Only displayed items? Or should theme developer also include hidden elements to make more information available for machines?  Some themes do not include information items (such as author’s full name, email and so on) simply because of the layout. Is it in this case desirable that  these information are also not available for machines?

I think per default (i.e. if the data owner does not define explicitly something else) all data should be available in a machine readable way. The application which renders the data decides based on whatever (e.g. layout) which data is finally displayed.

That was why I finnaly decided to manually include only few RDFa annotations to my blog, which simply expose which DOM nodes  belong to which externally described RDF resource:

<div class="post" id="post-<?php the_ID(); ?>" about="<?php the_permalink(); ?>" typeOf="sioc:Post">
<a rel="rdfs:seeAlso" href="<?php echo $post_uri ?>" type="application/rdf+xml" />

This solution has the advantage that only on each position where a Post or a Comment is described the RDFa annotation is added. This very sparse RDFa information is on the one hand enough to get the positional information someone might need (e.g. if something is selected and should be stored to a web clipboard) and on the other hand can be quickly added without wasting the theme.

Leave a Reply

Some basic HTML is allowed. Please keep all comments constructive, polite and on-topic. Any spam or offensive comments will be deleted.