I want to change the title and title head html element. I have tried with drupal_set_title() but Drupal insists on adding the site name to the title output. How can I override it so the title reads exactly as I want?

  • The question is a little too broad. Where are you exactly using drupal_set_title()? Saying you are using it in the template.php file is like using the function in a module. Also, you aren't asking any explicit question, but merely stating facts. Please add an explicit question.
    – apaderno
    Nov 3, 2015 at 8:58

2 Answers 2


You can change the page header title in template.php by adding the below code in template_preprocess_html().

 function my_theme_preprocess_html(&$vars) {
   if (current_path() == 'you_path') {
     $vars['head_title'] = t('header title');

The title in drupal_set_title() only refers to the page title, not the HTML title element in head. To change that you need to change the $head_title variable in html.tpl.php

Not the answer you're looking for? Browse other questions tagged or ask your own question.