After the installation of the nodewords module, Content-Type meta tag appears twice on all web pages. After analysis of the code, I modified in the function nodewords_preprocess_page the following line:

Original code

/**
 * Implements hook_preprocess_page().
 */
function nodewords_preprocess_page(&$variables) {
  $result = _nodewords_detect_type_and_ids();

  $tags = nodewords_get_tags($result[0], $result[1]);
  $parameters = array(
    'type' => $result[0],
    'ids' => $result[1],
    'output' => 'head',
  );

  drupal_alter('nodewords_tags', $tags, $parameters);
  $output = nodewords_output_tags($tags);
  drupal_alter('nodewords_tags_output', $output, $parameters);

  $variables['head'] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" .
    $output . "\n" . 
    drupal_set_html_head();
}

Updated code

/**
 * Implements hook_preprocess_page().
 */
function nodewords_preprocess_page(&$variables) {
  $result = _nodewords_detect_type_and_ids();

  $tags = nodewords_get_tags($result[0], $result[1]);
  $parameters = array(
    'type' => $result[0],
    'ids' => $result[1],
    'output' => 'head',
  );

  drupal_alter('nodewords_tags', $tags, $parameters);
  $output = nodewords_output_tags($tags);
  drupal_alter('nodewords_tags_output', $output, $parameters);
  
  // MODIFIED: Remove Content-type meta tag.
  $variables['head'] = $output . "\n" . 
    drupal_set_html_head();
}

And it has me allowed to resolve this problem. Could you place this patch in the future versions of nodewords ?

Thank you.

Comments

avpaderno’s picture

Status: Active » Closed (duplicate)

See #679322: Duplicated content type meta tag, where it is explained that the meta tag for the content type is output twice by Drupal. You would still see that meta tag appearing twice, even after you disabled Nodewords (or uninstalled it); also in Drupal.org, the content type is output twice (and Drupal.org is not running Nodewords).

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <!-- Note: does not validate. We would like it to, but that would mean reduced user experience for the majority of our visitors. -->
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
  <title>Edit comment | drupal.org</title>
  <meta http-equiv="Content-Style-Type" content="text/css" />

The latest Nodewords code has been already changed, though.