0

I'm using the Meta Tags module to pretty up my page titles using tokens. I want to display the taxonomy term parents in the page title, with separators. It's working, except I need it to also END with a separator. Though if no parent exists, I don't want the separator, obviously.

What I have so far:

[term:parents:join: - ][term:name] | [site:name]

But I want a dash (or pipe, or something besides a space) right before the term:name token for when there is a parent. But this:

[term:parents:join: - ] - [term:name] | [site:name]

Results in all page titles without parents to start with the dash. Any ideas?

2
  • See this other DAstackexchange thread with my un-approved answer drupal.stackexchange.com/a/24580/3279. When you have conditional things like this you tread the line of not having just a "token" anymore. So you have to find a way to alter this using code. drupal_set_title() is 1 way. Or messing with $vars['head_title'] in hook_preprocess_html() is another way.
    – tenken
    Commented Mar 14, 2013 at 15:17
  • Ugh, I was afraid it'd be complicated. I'll work on that, it does seem to be the answer. For now, I'm putting a single space - not the prettiest but it'll get me through today. Thanks!
    – Mike
    Commented Mar 14, 2013 at 15:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.