Skip to content

Instantly share code, notes, and snippets.

@joshuapowell
Created January 26, 2012 02:10
Show Gist options
  • Save joshuapowell/1680491 to your computer and use it in GitHub Desktop.
Save joshuapowell/1680491 to your computer and use it in GitHub Desktop.
Drupal: Update the meta elements in the <head> of the template that are generated dynamically. In this case we are setting the charset according to HTML5 standards and removing the generator meta tag, RSS meta tag, the default FAVICON, and the default sho
<?php
/**
* Implementation of hook_html_head_alter().
*/
function THEMENAME_html_head_alter(&$head_elements) {
// Update the charset to use HTML5 format
$head_elements['system_meta_content_type'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'charset' => 'UTF-8'
),
'#weight' => -1000
);
// Remove unnecessary <head> information
unset($head_elements['system_meta_generator']);
unset($head_elements['drupal_add_html_head_link:alternate:http://MYSITE/rss.xml']);
unset($head_elements['drupal_add_html_head_link:shortcut icon:http://MYSITE/misc/favicon.ico']);
unset($head_elements['drupal_add_html_head_link:shortlink']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment