Index: nodewords.module
=========================================================
--- nodewords.module	(revision 1.57.2.44)
+++ nodewords.module	Tue Jun 16 09:58:29 EDT 2009
@@ -246,10 +246,14 @@
 }
 
 /**
- * Implementation of hook_init().
+ * Implementation of hook_preprocess_page().
  */
-function nodewords_init() {
-  nodewords_add_html_head(nodewords_get());
+function nodewords_preprocess_page(&$variables) {
+  $head_tags = nodewords_add_html_head(nodewords_get());
+
+  if ($head_tags) {
+    $variables['head'] .= implode("\n", $head_tags);
+  }
 }
 
 /**
@@ -514,7 +518,9 @@
     $view_page = $view_page || _nodewords_views_match($current_path, $view_path);
   }
   if ($view_page) {
-    nodewords_add_html_head(nodewords_get('views', array($view->vid)));
+    foreach (nodewords_add_html_head(nodewords_get('views', array($view->vid))) as $tag) {
+      drupal_set_html_head($tag);
+    }
   }
 }
 
@@ -597,11 +603,15 @@
  ****************************************************************************/
 
 /**
- * Add the passed tags into the HTML HEAD tag.
+ * Convert the passed tags into the HTML HEAD tag elements.
  * @param $tags
  *  An array of tags to add.
+ * @return
+ *  An array of HTML tags.
  */
 function nodewords_add_html_head($tags) {
+  $head_tags = array();
+
   $tags_info = _nodewords_get_possible_tags();
   foreach ($tags as $name => $content) {
     // Avoid the disabled meta tags.
@@ -649,8 +659,10 @@
       '%attributes' => empty($tags_info[$name]['attributes']) ? '' : drupal_attributes($tags_info[$name]['attributes']),
     );
     
-    drupal_set_html_head(strtr($template, $replace));
+    $head_tags[] = strtr($template, $replace);
   }
+
+  return $head_tags;
 }
 
 /**
