Posted by epimeth on February 27, 2009 at 10:49pm
| Project: | Page Title |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (works as designed) |
Issue Summary
in the "default settings" page /admin/content/page_title
I place a value in the field for "Pattern for Page".
I then go to any node of type "Page" and see the title I entered - great!
Then I edit one of the nodes and in the "Page title:" field I enter some other text.
I go to view the page and the title remains the same as the one I entered in "default settings - pattern for Page".
Only when I remove what I entered in "Pattern for Page" does the text I entered in "Page title" appear.
Comments
#1
What did you put in the Pattern For Page? Did it contain [page-title] or [title]?
#2
I'm not sure if this is a bug or by design, but the behavior I expect here would be for page titles set at the individual node level to override the defaults set in the admin settings. Currently this does not happen if there is a default set for a particular node type. The issue occurs in the page_title_page_get_title() function. The attached patch against 6.x-2.x-dev is an attempt to fix this.
Note: This patch is only for the "node" scope within the aforementioned function as I do not have occasion to test the other scopes at the moment. I assume patching the other scopes would be as trivial as this patch. I can look into this when I have time but that won't be for at least a couple of weeks.
#3
There are two parts to Page Title.
[page-title]token if you want the ability to override. This is a special token provided by the Page Title module which will use the value of the Page Title field (if specified) but fall back to just the object title if no overriding value is available.I hope this provides some clarity.
#4
I think the original poster is trying to do the same thing as I'd like to do. Essentially I've got a node type where the default value is :
[title] | [site-name]
but in the case where I've put in a page title for a specific node, I want it to completely override the entire title for that node. In other words not include the site name at all.
The problem is that if I swap the [title] above for [page-title], then there is still no way to not show the " | [site-name]" part unless I manually add it to every node.
Is it possible to have an option where you can let the individual node page titles completely override the defaults for that node type? Make sense?
Thanks,
Nick
#5
I think the behavior of Page Title should let you specify replacement patterns per content type, and use them, -only- if a user provided title does not exist for the node. That is how pathauto works. Imagine if Pathauto let you give a custom URL then said 'ummm no heres one based on default pattern for Page' instead.
It looks like if a pattern is specified for a content type, and you put in a custom title for a node, it uses the default pattern anyway.
It seems like an easy fix to check the Page Title field when processing the form submission to know to either use what the user provided, or use the default page title setting(s).
#6
Would also love to see this change commited.
#7
The above is either:
1) A misunderstanding about the different between a Page Title and a Page Title Pattern (one is a value to be inserted into the other)
or
2) A Feature Request to allow Tokens in the Page Title field on a per-node basis. This would be possibly but I'd prefer to manage that in a separate task (to remove "noise").
There is also the possibility this task is about providing a default value for the Page Title field. I'm not sure why you'd EVER want that as it increases the chance of a duplicate Page Title. Besides, the [page-title] token will inherit the Node Title if no Page Title value is found on the node.
#8
I needed the page title to work like:
1) if page title is provided, use that "as is" (don't use default pattern)
2) if not provided, use the pattern
So, used the hook_page_title_pattern_alter like:
function mymodule_page_title_pattern_alter(&$page_title_pattern, &$types) {if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->page_title) {
$page_title_pattern = '[page-title]'; // only use page title not default pattern
}
}
}
It works great.
#9
Replying to comment #4 - "but in the case where I've put in a page title for a specific node, I want it to completely override the entire title for that node. In other words not include the site name at all."
I had the same issue, but found a simple fix provided here: http://drupal.org/node/389838 . I added this code to my theme's template.php and it works.