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?
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
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. – kiamlaluno♦ Nov 3 '15 at 8:58