views:

228

answers:

2

Hey Everyone,

I am trying to customize the $head variable in my page.tpl.php template, because there are two instances of

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

appearing, which I believe is affecting the site from being validated using W3C's Markup Validation Service. Any help would be much appreciated, thanks!

+1  A: 

Well, first of all I'd try and figure out WHY you're getting duplicates of that. Manually removing one is more of a hack than a fix.

That said, you can customize $head using template_preprocess_page. In your theme's template.php, do something like:

<?php 
function THEMENAME_preprocess_page(&$variables) {
    // use $variables['head'] here and do whatever you want with it, such as...
    $variables['head'] = str_replace('blah blah','blah',$variables['head']);
    // ...although that's completely untested and might not work
}
Mike Crittenden
Yea, I'm trying to figure that one out. Checked my .info file, and page.tpl.php file and I dont see where it could be coming from. I am aware of that preprocess function but as you said, I am trying to figure out where the duplicate may be coming from.
alvincrespo
A: 

This seems to be a bug in the Drupal API, the discussion can be followed here:

http://drupal.org/node/451304#comment-2632954

Seems that even drupal.org is duplicating the content type meta tag.

alvincrespo