Created
October 30, 2013 15:59
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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