Enable RDFa usage with Drupal 6.x

Arto - March 4, 2009 - 22:35
Project:Resource Description Framework (RDF)
Version:6.x-1.x-dev
Component:Interoperability
Category:feature request
Priority:normal
Assigned:Arto
Status:active
Issue tags:caching, DOCTYPE, RDFa
Description

Provide configuration settings to enable the use of RDFa in Drupal 6.x.

To make RDFa available as widely as possible, support automatically replacing the default DOCTYPE in any themed output with the XHTML+RDFa DOCTYPE, as well as adding in any needed namespace declarations to the HTML tag (these can both be implemented using PHP's output buffering).

Also evaluate whether the default HTML input filters need improvements in order to cleanly pass through RDFa properties.

#1

Arto - March 4, 2009 - 22:49

Changeset [179044] implements the automatic DOCTYPE replacement. It works by looking for the opening HTML tag in the first 15 lines of output, and if the tag is found it replaces anything prior to that offset with the XHTML+RDFa 1.0 DOCTYPE declaration.

The replacement is done via PHP's output buffering mechanism and takes place after hook_exit() is run. This feature is most likely incompatible with Drupal's aggressive caching, and possibly (though not necessarily) with the static caching provided by Boost as well.

The feature only activates if the administrator has enabled it at admin/settings/rdf#rdfa, and only if the page being served actually contains an HTML response. This, along with the 15-line lookahead limit, ought to make it as robust as possible - which is needed, since error handling in the output buffer callback is all but impossible, and debugging any problems there ain't any fun either.

Please report any incompatibilities or bad interactions with other modules that you may experience.

#2

Arto - March 5, 2009 - 00:44

Changeset [179078] implements a configuration option for selecting which namespace prefixes to enable for RDFa usage, and then injects those prefixes as xmlns:prefix="uri" attributes into the HTML opening tag.

There's more RDFa support that could be implemented, but this present level should now be enough to enable basic RDFa use for anyone who has the RDF module installed and is using the "Full HTML" input format to edit their content.

#3

scor - July 22, 2009 - 14:05

Make sure however you don't allow the full HTML filter to be used by anonymous or non trusted users for security reasons.

#4

digi24 - July 27, 2009 - 22:09

The commit in #1 and #2 may render AJAX forms unusable, please see #476280: RDFa setting breaks json output of some modules

 
 

Drupal is a registered trademark of Dries Buytaert.