Hi,

I need some help about <title> in nodes except the main page.

Every node shows "Blah, blah, blah... | TheNameOfWebSite".
I would like to delete the pipe sign and the name of the website because readers complained about the part is not necessary and, in fact, cumbersome when they want to bookmark some pages.

Any help would be appreciated.

Comments

techczech’s picture

Try the Page title module: http://drupal.org/project/page_title. I think it does what you need.

______________________
Dominik Lukes
http://www.dominiklukes.net
http://www.hermeneuticheretic.net
http://www.czechupdate.com
http://www.techwillow.com

Chill35’s picture

There's a much simpler way to do this stuff then using a contributed module.

In page.tpl.php we've got this :

<title><?php print $head_title ?></title>

Where is $head_title defined ?

I'd like to know myself.

Doing a search site-wide for the string "head_title" I found nothing !!!!!????

Chill35’s picture

It's in phptemplate.engine

// Construct page title
  if (drupal_get_title()) {
    $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
  }
  else {
    $head_title = array(variable_get('site_name', 'Drupal'));
    if (variable_get('site_slogan', '')) {
      $head_title[] = variable_get('site_slogan', '');
    }
}

The code that sets the $head_title is here :

$head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));

Then on line 206 of the same file, we have :

'head_title' => implode(' | ', $head_title),

SO, the way to fix this is very simple.

STEP 1 : open the file phptemplate.engine in the editor of your choice.

STEP 2 : go to line 189 and change it to :

$head_title = array(strip_tags(drupal_get_title()));

And you're done.

takaakikato’s picture

Thanks for your help, guys. I'll try that out.

--
Samurai Coder

mooffie’s picture

and if you want to avoid touching the core, either:

  1. Make the modifications directly in your private 'page.tpl.php'; or
  2. Implement a _phptemplate_variables() in your 'template.php'. Search for more info.
Chill35’s picture

Yes, that's right : phptemplate.engine is considered core, yes, even if it's in the /themes folder. Sorry about that. It's the engine of all templates! Let's not touch the engine. Do you have your mechanic card ? Neither do I. LOL...

dotidentity’s picture

This is my situation: node title | page title
How to change this to: page title | node title ??
I am trying to edit the drupal_get_title() but this doesnt do the trick.

quip’s picture

STEP 1 : open the file phptemplate.engine in the editor of your choice.

STEP 2 : go to line 189 and replace it from :

$head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
to
$head_title = array(variable_get('site_name', 'Drupal'), strip_tags(drupal_get_title()));

meba’s picture

Do not do this.

Do this instead:

function _phptemplate_variables($hook, $vars = array()) {
if ($hook == 'page') {
$vars['head_title'] = WHATEVER_YOU_WANT_TO_DO;
}
return $vars;
}

tassoman’s picture

Into page.tpl.php 've did a str_replace of $head_title ... It's less intrusive than a module -_-'

<title><?php echo str_replace('|', '»', $head_title);?></title>

___________
by Tassoman

geek, net addicted user