[uf-discuss] Custom Fields Microformat?

Manuel Simoni msimoni at gmail.com
Sat Nov 25 04:02:50 PST 2006


I've dabbled a lot with RDF and XHTML 2.0's Metainformation Module,
but I've come to the conclusion that custom fields, as present in a
wide variety of systems, from Linux file systems with extended
attributes to Google Base, are good enough most of the time.

I think that a microformat could bring together the many different
variations of custom fields in use today, specifically in the blog and
CMS scene, and could offer a lot of value to the emerging Data Web.
So, here it goes...

Custom fields are user-defined name/value pairs added to a weblog or
CMS entry. For example, a user employing his CMS as a bug-tracker
could add "reporter", "priority" and "related-bugs" fields.

Many blogging and CMS platforms provide custom fields, including
Wordpress (built-in), Drupal (Content Construction Kit (CCK) plug-in),
Movable Type (CustomFields and RightFields plug-ins), and TextPattern

I have analyzed the existing custom field rendering of Wordpress and
Drupal/CCK and have found that they could easily be unified using just
three classes:
- hcustomfield encloses a field,
- hcustomfield-name encloses the name of a field,
- hcustomfield-value encloses each value of a field.
(This structure is used for expository purposes only, and is not meant
as an attempt for a final microformat.)

Here is Wordpress' default rendering of custom fields:
<ul class="post-meta">
    <span class="post-meta-key">Priority: </span>

Adapted to hcustomfield-* classes:
  <li class="hcustomfield">
    <span class="hcustomfield-name">Priority</span>:
    <span class="hcustomfield-value">low</span>

Here is Drupal/CCK's default rendering of custom fields:
<div class="field field-type-text field-field-priority">
  <h3 class="field-label">Priority</h3>
  <div class="field-items">
    <div class="field-item">low</div>

Adapted to hcustomfield-* classes:
<div class="hcustomfield">
  <h3 class="hcustomfield-name">Priority</h3>
    <div class="hcustomfield-value">low</div>

The hcustomfield-* classes make a unified extraction algorithm
possible, and require only minimally invasive changes to existing
rendering code.

Some notes:
- Between systems, there is no agreement on field naming and namespace
- All systems allow strings (HTML?) and some allow <a href="...">
references as field values.
- Some systems allow multi-valued fields while others allow only
single-valued fields.

Here's a full example:
  <div class="hcustomfield">
    <span class="hcustomfield-name">multi-valued field</span>:
    <span class="hcustomfield-value">value 1</span>
    <span class="hcustomfield-value">value 2</span>
  <div class="hcustomfield">
    <span class="hcustomfield-name">field with a link</span>:
    <span class="hcustomfield-value"><a href="/foo">a link</a></span>

What do you think?


Manuel Simoni

More information about the microformats-discuss mailing list