1

I tried Page Title module however it seems that it can configure page titles only on the content type level.

I can make a temple for this page and write the title directly in there but I don't feel like overriding the template file just for the title tag.

Is there any other way to set the title to just one specific page (node view page)?

3

You can manage this in template.php file.

function MYTHEMENAME_preprocess_page(&$vars) {
    $vars['title'] = $custom_title;
    $vars['head_title'] = $custom_title;
}

Just put the condition in the page like for specific path, content type etc. and change the title of the page.

function mytheme_preprocess_page(&$vars){
    if (isset($vars['node']) && $vars['node']->type == 'news'){
        drupal_set_title('News');
    }
}
2

Some how I had a problem for front page browser title. Our site name was working properly. But only for front page we can't see browser header title. I used the following code only for front page-

/**
 * implements hook_preprocess_html()
 * @param $vars
 */
function YOURTHEME_preprocess_html(&$vars) {
    if(drupal_is_front_page()){
        $vars['head_title'] = "Home | " . variable_get('site_name');
    }
}
0

Try this one:

/**
 * Override or insert variables into the html template.
 */
function THEMENAME_preprocess_html(&$vars) {  
  switch ($vars['menu_item']['path']) {
    case 'profile-profile/%':
      $vars['head_title'] = implode(' | ', array('Hello!', variable_get('site_name')));
      break;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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