I'm trying to figure out where the <head>
for all of the pages in Drupal is (I'm using Orange theme if it matters). I have to add analytics code into the <head>
.
Inside which file would I find the <head>
?
Use drupal_set_html_head()
by placing this in your themes template.php file. If the function MYTHEMENAME_preprocess_page()
already exists insert what is inside the {
closure}
brackets below (before the $vars['head']
if that exists in it as well) :
function MYTHEMENAME_preprocess_page(&$vars, $hook) {
// say you wanted to add Google Webmaster Tools verification to homepage.
if (drupal_is_front_page()) {
drupal_set_html_head('<meta name="google-site-verification" content="[string from https://www.google.com/webmasters/verification/verification]" />');
$vars['head'] = drupal_get_html_head();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With