I'm keen to see the hCard implementation on this. I've tried to do some work on it myself in D6, but the D6 theme functions don't have the flexibility to do it well.

I think what you're actually proposing is the adr microformat, right? That's just the address part of the hcard. If you are going to include names and organizations, I've already written some code and tests for implied N optimization in D6.

#6 hcard.template.patch3.15 KBDjebbZ
Members fund testing for the Drupal project. Drupal Association Learn more


Damien Tournoud’s picture

The current version of the module is the D7 port of a work I did for a client last year, and only support xAL and adr. The idea is to extend it with name and organization, implementing xNAL and hCard.

The current theming implementation in the module is really not flexible enough to do that properly. I'm wondering how to do it right so that we can have both RDFa and microformat decorations in the same markup.

Anonymous’s picture

Well... I think the challenges are probably the same to write produce either microformats or RDFa. This field has many elements, and the standards specify attributes in the HTML element but not the HTML element itself.

For this problem, I experimentally created an abstract XML DOM element (a D6 hook_elements() element). I thought if this were an array, the (RDFa and microformat) attributes and values could be added separately from the element itself. Different layers could handle all of the concerns through drupal_alter(), the default would be div or span.

But I wasn't prepared to go all the way down that road. It started to feel hostile to developers and themers. I thought there might be smarter ways that could rely on other libraries... querypath? something at least designed for the purpose of manipulating XML.

Damien Tournoud’s picture

Category: support » feature

Promoting as a feature request.

Damien Tournoud’s picture

I also opened #797912: Rich Snippets integration to start a discussing about the RDFa part of this.

BenK’s picture


DjebbZ’s picture

Status: Needs review » Active
3.15 KB

Here's a patch for hcard implementation, taken from here. Furthermore, it also solves by the same way a themability issue, with some tags and classes missing to give full control to themers.

Some class names have changed from their xNL to their hcard counterpart, but it shouldn't be a problem since xNL is used to structure the address, and hcard only format the presentation for search engines and browsers and co.

Once it's committed, country-specific address templates will need to be updated.

Bojhan’s picture

Status: Active » Needs review
Issue tags: +dcsprint5

@DamZ reviewze, please :)?

DjebbZ’s picture

Status: Active » Needs review

Just a note : I've validated the markup with the Optimus microformats validator. But as I'm developing locally, the "OK" result may be irrelevant. It may need to be tested online.

Damien Tournoud’s picture

Status: Needs review » Needs work

The -reloaded branch has been merged, so this is going to need to be reimplemented.

One thing I would like is integration with the microformats module. It should be easier now that we don't have templates anymore.

Mac_Weber’s picture

Maybe #797912: Rich Snippets integration should be merged with this issue?

bojanz’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

3 years without activity, no valid patch.
Newer activity in #1259582: Support microdata in addressfield and #797912: Rich Snippets integration.

Reopen if you decide to work on this.

rhclayto’s picture

With the patch at https://www.drupal.org/node/1259582#comment-9893027 , Addressfield will support the Microformats module for adding microformats to the address field.