Posted by brendan.lynch on December 12, 2008 at 12:13pm
Hi folks,
I need to add custom metatags to nodes in particular I need to add the Dublin Core set eg "[meta name="DC.Creator" content="My organisation etc" ]". There are over 10 tags. Can I use nodewords or node (key)words module or is there a better way?
many thanks - Bren

Comments
Node words
http://drupal.org/project/nodewords
is pretty much ready for D6.
I haven't used it for DC tags - I haven't used them very much.
Depending on your use case, and how much you intend to customise the DC tags,
you could just put them in your page.tpl.php file.
Regards
Alan
MetaTags
Hi Alan
Tnx for reply. I need a DC set for each node. I could pop most into the page.tpl.php file (hard type or file include?). But DC.type & DC.subject will vary from page type eg Press release Vs Price statement Vs Policy doc etc. Also CD.date created is another awkward one. Could one bodge nodewords?
Bren
Nodewords isn't Dublin Core Ready
I've done some work to implement Duplin Core in Drupal here - http://openconcept.ca/blog/mgifford/adding_dublin_core_metadata_to_drupal
Mike
OpenConcept | CLF 2.0 | Podcasting
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
Metatags
Alan,
UPDATE: trick use of "print" the €title & $base_path vars in the page.tpl.php file - metatags area gets me far down the road. Do you know the €variables that give the node creation and edit dates. Can they be populated into the page.tpl.php file?
Ta! Bren
you should be able to do a
you should be able to do a lot via template.php, or worst case via a new module of your own. The best place to read on that is the Theming guide. The devel might be helpful here too as it comes with a theme developer module (Drupal 6).
Progress on meta tags re node dates
Here's some code that works.
Put this or similar in your page.tpl.php file
1
<?php$node_array = get_object_vars($node);
?>
2
<?php$changedstmp = $node_array["changed"]
?>
3
<?php$node_changed_date = format_date($changedstmp)
?>
4
<?php$createdstmp = $node_array["created"]
?>
5
<?php$node_created_date = format_date($createdstmp)
?>
6
<meta name="DC.Date Created" content="<?php print $node_created_date ?>" />7
<meta name="DC.Date Modified" content="<?php print $node_changed_date ?>"/>Explanation:
Clean theme has this funtion in the "template.php" file
function phptemplate_preprocess_node(&$vars, $hook) {
$node = $vars['node'];
Which makes a stdclass object called €node available. You could put this in your template.php file
Line 1 gets the $vars out of €node and into an array called $node_array
Line 2 gets the value for the key "changed" into $changedstmp
Line 3 formats this value to a date because its a unix time stamp ie number of seconds from 1970 (verry long number)
Line 6 pops this date (dd/mm/yy) into the html meta tag in the page.tpl.php file.
Lines 4,5 & 7do the same for the node created date
There's probably a more elegant way to do this but it works.
Many thanks for help & advice given.
Bren