Some of my pages have queries with type "ref".
So i changed my Page title to this:
[current-page:page-title] | [site:name] [current-page:query:ref]
If there is a ref query in page, this works fine.
But if there is no "ref" query, page title becomes like this:
My Page | example.com [current-page:query:ref]
I think module should show empty string for query part of page title.
Is this a feature or bug?
Comments
Comment #1
trante commentedAny comments?
Comment #2
trante commentedAny comments?
Comment #3
nicholasthompsonNeither - this is a misuse of Tokens as far as I can tell..
If a token doesn't exist, there will not be a string replacement.
If this is a feature you need, I suggest you open a ticket with Tokens.
Alternatively, if its a niche requirement, you could quite easily implement hook_tokens and hook_token_info in a custom module to provide the output you need.
Marking as closed.
Comment #4
trante commentedThank you very much.
Comment #5
giorgio79 commentedHello Nicholas,
Mind if I reopen?
In some cases the field does not contain a value, even if it exists.
In these cases the token is outputted as well, but I think it should not.
Comment #6
kingdee40 commentedI believe this should be included in page title, [term:name], [term:parent] will work in 90% of the cases until you land on a page that doesn't have a parent, then it will output Name, [term:parent].
Comment #7
Refineo commentedI have the same issue with [current-page:query:*] . I believe this is directly relevant to Page Title module.
I would like to use tokens in page titles but I cannot be sure these tokens are set (they are not always set for all pages).
If a token is not set (esp. [current-page:query:*] ) then page title should hide the token instead of displaying token code itself.
Comment #8
Refineo commentedPlease see #1614456: [current-page:query:?] should fall back to empty string : "The responsibility is on the module calling token_replace() to use $options['clear'] = TRUE to replace any tokens that do not have values with empty strings."
Comment #9
Refineo commentedTo overcome this issue I use http://drupal.org/project/metatag module istead. It contains the Page title functionality and token fallback to empty strings works fine there.
Comment #10
kingdee40 commentedThanks for the info, I will have to see how the metatags module holds up with panels and views.
Comment #11
FAAREIA commentedI'm having this issue too. Token value
[something]is printed even if it's empty. Hope someone can help about it.@kingdee40. I tested mtatags and you can't print meta on panel pages. At least, 2 month ago or so.
Comment #12
Jvon3L commentedI have the same issue. All works well accept for those tokens that don't have a value. When the value doesn't exist the replacement pattern is printed where it shouldn't.
Looking at how long this issue exists I was wondering if there any outlook as to when this will be fixed?
Comment #13
kingdee40 commentedPage title module is not too active anymore, so I would guess never unless someone provides a patch.
Comment #14
petrovnn commentedthis issue is dublicate of: http://drupal.org/node/1290080 - with bonus patch
Comment #15
FAAREIA commentedAs petrovnn said in #14. This issue is duplicate and the patch works for me.
Thanks petrovnn.