This patch introduces a new fieldset in admin/build/themes/settings where the various RDFa annotations can be switched off (default to on). The other elements to be RDFa annotated in the future could be centralized there.

The attached patch annotates author and date in nodes and comments.

todo:
- add annotation for non registered users in theme_username()
- create a theme_date function which wraps the output of format_date in the right HTML tags?

I've tried to bring as less changes as possible in the tpl files but there might be a better way to integrate this. An alternative option for the date is to add a non visible <span /> tag like:

<span property="dcterms:created" content="2008-12-10T15:25:57+00:00" />

in the node/comment (outside the 'submitted by' element). The equivalent RDF is the same.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

FileSize
8.55 KB

adding support for chameleon theme.

Dries’s picture

This patch turns me on. :)

I'm not sure we need to make this configurable, to be honest. In my view of the world, this should happen automatically BUT in theme_ functions so it can be removed. Thoughts on that.

Boris Mann’s picture

We're going to have to make a community "philosophy" decision here. I remember back when we were switching to clean layouts and CSS. Lots of people still say that Drupal "spits out too many CSS classes". Except, of course, that it's fairly easy to turn off / override when you get to the level where you need it.

Another item that has long been "troublesome" for some people is that it is relatively difficult to turn off RSS output from Drupal.

I am +1 for emitting RDFa by default. There are two ways that changes / overrides could be done:
* an rdfa_helper module that does configuration and/or turns off output (someone can make this in contrib if they want it)
* in the theme, where all the RDFa output can be overridden

Glad to see this rolling along. Next would be to maybe include some sort of RDFa consumer and/or set up a drupal.module style aggregator that does "interesting things" with the RDFa data being emitted by default. e.g. all posts / comments made by Boris anywhere

scor’s picture

Issue tags: +RDF
FileSize
8.6 KB

rerolling

scor’s picture

FileSize
6.87 KB

rerolling

scor’s picture

Make sure to subscribe to the main issue #493030: RDF #1: core RDF module which is where most of the activity is happening at present. I will update the patch above asap based on the main RDF module for core.

ronald_istos’s picture

I also believe RDF should be on by default and a kind of "if you don't know about it you will never even find out" feature but after some of the comments I heard at Drupalcon Paris I think it will save a lot of headache for support people if there are some switches in core to switch RDF or parts of it off.

From discussions I've had trying to convince people of the utility I fully expect that after 7 is out people will say "What is all this in my code? I don't understand it, I want it out, etc" or they will simply see HTML they never saw before and think that is what is messing their site, etc.

There is still a lot of educating to happen about RDF and before that happens probably best to make life simple for however will have to field such questions and have a "switch off" button (which I guess is what disabling the module may do but for newbies that might not be obvious) and also a "switch off" x, y and z functionality so that people feel they are in control and the ones that worry can quickly see that RDF is not what is messing their HTML (believe me I've seen this more than once).

sun’s picture

+++ includes/theme.inc	12 May 2009 11:14:09 -0000
@@ -922,6 +922,8 @@ function theme_get_settings($key = NULL)
     'toggle_main_menu'                 =>  1,
     'toggle_secondary_menu'            =>  1,
+    'rdfa_date'                     =>  1,
+    'rdfa_author'                   =>  1,
   );

Wrong indentation.

+++ modules/comment/comment.module	12 May 2009 11:14:10 -0000
@@ -1966,10 +1966,17 @@ function template_preprocess_comment_wra
-  return t('Submitted by !username on @datetime.',
...
+    $date_iso8601 = format_date($comment->timestamp, 'custom', 'c');
...
+  return t('Submitted by !username on !datetime.',
...
-      '@datetime' => format_date($comment->timestamp)
+      '!datetime' => $datetime,

The @-placeholder performs an additional check_plain() on the value, which is missing for $date_iso8601 now (strange variable name, btw).

However, I just realized that the overriden theme functions use a !-placeholder - so... is the returned value of format_date() actually safe or not?

Beer-o-mania starts in -6 days! Don't drink and patch.

scor’s picture

Status: Needs work » Closed (duplicate)

this functionality was committed as part of the main patch at #493030: RDF #1: core RDF module