Skip to content

Instantly share code, notes, and snippets.

@SteAllan
Created October 30, 2013 15:59
Show Gist options
  • Select an option

  • Save SteAllan/7235178 to your computer and use it in GitHub Desktop.

Select an option

Save SteAllan/7235178 to your computer and use it in GitHub Desktop.
Add additional meta tags to the <head> in Drupal 7 (from http://pastie.org/private/npzlsszuoqlopyyjkr0qw)
/**
* Preprocesses the wrapping HTML.
*
* @param array &$variables
* Template variables.
*/
function sintillate_preprocess_html(&$vars) {
// Setup IE meta tag to force IE rendering mode
$meta_ie_render_engine = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'content' => 'IE=edge,chrome=1',
'http-equiv' => 'X-UA-Compatible',
)
);
// Mobile viewport optimized: h5bp.com/viewport
$meta_viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'content' => 'width=device-width, initial-scale=1.0',
'name' => 'viewport',
)
);
// Add header meta tag for IE to head
drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine');
drupal_add_html_head($meta_viewport, 'meta_viewport');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment