I'm using the Page Title module (http://drupal.org/project/page_title) to set the tags on nodes, etc. I'm using the [current-page:page-title] token in my patterns.
According to the manual (http://drupal.org/node/254771), this should let me write a custom page title on node level.

This allows some nodes to 'inherit' the title from the node title and other nodes have the option to override the [page-title] token.
[...] in this case, the author could override the node title and provide a separate page title [...]. Note that this field does not allow the admin to completely override the Page Title, but just the [page-title] token, which will be inserted as normal into the Pattern for that node type.

And the manual also says:

So, basically, if you use the [page-title] (or [current-page:page-title] in Drupal 7) token in the patterns/template settings, it will take it's value in the following order:

1. the value of the "Page Title" field.
2. the Entity Title (eg, Node Title, User Name or Term Name), if Page Title field has no value (in 1).
3. the value of the title returned by Drupal's "get title" system (i.e. a fallback). This is usually defined by the Menu API system.

However, when the pattern is set to [current-page:page-title] and I do NOT write anything in the Page Title feed on node level. Then the node gets no title at all. It doesn't fall back to the pattern: It simply doesn't get any title.

Have I misunderstood anything?

Comments

SandraL’s picture

I'm having the same problem with [current-page:page-title]. The page title field is always overriding the node title, even if the field is left blank. As a result, pages which don't have anything in this field don't get a title at all. (Or rather, in my case, they get "| My Site Name", when it should be "Page Title | My Site Name".)

Edit: On closer inspection, it appears this has something to do with my theme. I tried it in another theme (Fusion-based, of all things) and it worked exactly as expected. As far as I can tell, neither theme is modifying the $head_title variable. I'll keep digging.

SandraL’s picture

I'm still not sure why it was working in one theme and not another as the broken theme wasn't clobbering $head_title in any way.

I've managed to get it working for nodes by adding the following to my template.php:

function MYTHEME_page_title_alter(&$title) {
	$node = menu_get_object();
	if (empty($title) && !empty($node)) {
		$title = filter_xss($node->title);
	}
}

I still need to add support for views, etc., but this appears to have solved my biggest headache.

Anonymous’s picture

There is probably a deeper problem. I also use '[current-page:page-title] | [site:name]' as the fallback, but even on the following pages the title is completely missing:

/user
/node/add
...

These type of pages don't seem to have a '[current-page:page-title]', so it just shows

| Site Name

Anonymous’s picture

To me it seems that '[current-page:page-title]' is simply an empty token on many pages, even if I add drupal_set_title('mytitle') in code.

Anonymous’s picture

Status: Needs review » Active

I implemented the fix from #2 in my template.php, and it works. The [current-page:page-title] token is simply empty in many cases, it does not fallback to the node title.

Anonymous’s picture

Issue summary: View changes

fixing markup

eljefejb’s picture

Is the code from #2 new code in template.php, or a copy/paste/override? I've used templates before, but this will be my first theme function override. Thanks!