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

trante’s picture

Any comments?

trante’s picture

Any comments?

nicholasthompson’s picture

Status: Active » Closed (works as designed)

Neither - 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.

trante’s picture

Thank you very much.

giorgio79’s picture

Status: Closed (works as designed) » Active

Hello 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.

kingdee40’s picture

I 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].

Refineo’s picture

I 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.

Refineo’s picture

Please 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."

Refineo’s picture

To 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.

kingdee40’s picture

Thanks for the info, I will have to see how the metatags module holds up with panels and views.

FAAREIA’s picture

I'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.

Jvon3L’s picture

I 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?

kingdee40’s picture

Page title module is not too active anymore, so I would guess never unless someone provides a patch.

petrovnn’s picture

this issue is dublicate of: http://drupal.org/node/1290080 - with bonus patch

FAAREIA’s picture

Status: Active » Closed (duplicate)

As petrovnn said in #14. This issue is duplicate and the patch works for me.
Thanks petrovnn.