This is a similar issue to http://drupal.org/node/1887916, but I am not using page_title.

I have a Drupal 7, Panels 7.x-3.3, cTools 7.x-1.2 site. When I have metatag_panels enabled, and have the variant config to enable metatags configuration. It looks like the [current-page:title] token is always empty when I want to use it anywhere in metatags. Custom text works, and other [current-page] tokens work. The title is being propagated properly through the theme system (eg, it is correct in my region template). In my instance, I am using a manually set title, but changing this doesn't seem to matter.

Not sure what is wrong here.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Postponed (maintainer needs more info)

How is the page title configured on the variant itself?

mpdonadio’s picture

Status: Postponed (maintainer needs more info) » Active

Title type == Manually set

Title == %substitution

where %substitution is defined by my ctools context. I need to see if all of my variants are using substitutions.

DamienMcKenna’s picture

At a guess I wonder if this is purely a page execution problem? The [current-page:title] value might not be set until Panels runs, maybe Metatag is executing first so it doesn't see the values being set by Panels later on? Try bumping the 'weight' value of metatag in the {system} table to something higher than Panels' value, see if that helps.

mpdonadio’s picture

Changing the weight didn't help, even after a few cache clears.

I noticed that og:title doesn't appear at all when I use the Panels node page override.

I also noticed that if I override the Global Page Title, that the panel variant title will override this.

I will try to spin up a test site so I can get some debug in Metatags, Page Manager, and Panels to see what is really going on.

DamienMcKenna’s picture

Component: Code » Documentation
Category: bug » task

I think this is ultimately by design - if you want to assign the title using the Metatag section you need to leave the Page Title set to "no title".

This needs to be documented.

theunraveler’s picture

I know this module is now deprecated, but I ran into this issue as well, and upgrading to metatag 7.x-1.0-beta6+ was not an option. Here's a patch that fixes this problem for those of you in the same situation.

devuo’s picture

Project: Meta tags: Panels » Metatag
Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Component: Documentation » Code

The module is not deprecated, the module has been merged with metatag module. This issue now belongs there.

greggles’s picture

Status: Active » Needs review

Better status, I think.

Also following.

Status: Needs review » Needs work

The last submitted patch, metatag_panels-page_title-1918706-6.patch, failed testing.

DamienMcKenna’s picture

Title: Blank Titles when using [current-page:title] » Blank titles when using [current-page:title] on Panels pages
Status: Needs work » Needs review
FileSize
747 bytes

This fixes a) the file path, b) using $info['title'] instead of $metatags['title'].

DamienMcKenna’s picture

Category: task » bug

This is more of a bug than a task.

DamienMcKenna’s picture

FileSize
725 bytes

How's about this instead? Just set the page title if one was assigned.

devuo’s picture

Status: Needs review » Reviewed & tested by the community

Seems okay with me!

beowulf1416’s picture

I set up a panel that has a title with substitutions. Metatag is configured to this: [current-page:title] | [site:name]

What happens is that only '| [site:name]' is showing up.

DamienMcKenna’s picture

@beowulf1416: What is the panel's title set to? Did you try the patch?

beowulf1416’s picture

Just read the reply now. The panel's title is set to 'No Title'. I will try the patch and feedback later. Thanks.

MustangGB’s picture

Didn't work for me, gave an error about it being an array, even using the value in the array didn't work.

I changed it to drupal_set_title($info['title']); and it worked as expected.

Zekvyrin’s picture

I'm not 100% sure that this is metatag_panel's issue or panels should do it earlier.

My issue is pretty similar but the proposed solutions above don't resolve it. My [current-page:title] is actually filled from somewhere else, but the fact remains the same:

[current-page:title] is not updated to use the Title set on Panel (either manually or "from pane" or maybe to unset the title).

Using $info['title'] instead of $metatag['title'] and #12 patchs works for me.
$metatag['title']['value'] contains the pattern I used on metatags (for example : "[current-page:title] | [site:name]").

Also, I think Patch #10 might be wrong because title could have been set elsewhere earlier. For example when overriding a taxonomy term page, drupal_get_title will return term's name, so it won't be empty and the patch will not .

Zekvyrin’s picture

Issue summary: View changes
FileSize
719 bytes

Sorry for the wrong patch number. I was expecting to attach it to #18.
The patch is using $info instead of $metatag.

Works for me in both beta7 & dev versions.

Zekvyrin’s picture

Status: Reviewed & tested by the community » Needs review
jerry’s picture

The patch in #19 appears to be working fine for me.

DamienMcKenna’s picture

Component: Code » Panels integration
mariusm’s picture

Please add patch #19 to dev.

Thanks

scotwith1t’s picture

+1 for committing #19. works for me.

scotwith1t’s picture

Status: Needs review » Reviewed & tested by the community
DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
717 bytes

Removed errant spaces at the top of the patch.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

Sorry, was just doing a test for a local user group. Thanks for the patch, I'll review it shortly.

lpalgarvio’s picture

works great

JeroenT’s picture

I applied this patch, and it works great, except when I have a title with an &, it shows & amp;

JeroenT’s picture

FileSize
731 bytes

How about something like this?

rroblik’s picture

#30 working fine,

Will we see this patch in the recommanded version (7.x-1.0-rc1) ?

DamienMcKenna’s picture

@rroblik: 1.0-rc1 was already released, so it wasn't added. Maybe for the next release.. =)

DamienMcKenna’s picture

A question for anyone who has tried this? Are tokens still processed in it, e.g. [site:name]? (I haven't tested it yet)

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Commited. Thanks everyone!

JeroenT’s picture

Great! Just one nitpick, my username is JeroenT instead of JeroeT :-)

  • DamienMcKenna committed a094811 on 7.x-1.x
    Issue #1918706 by theunraveler, DamienMcKenna, Zekvyrin, JeroenT: [...
  • DamienMcKenna committed c96248a on 7.x-1.x
    Revert "Issue #1918706 by theunraveler, DamienMcKenna, Zekvyrin, JeroeT...
DamienMcKenna’s picture

JeroenT: Sorry about that, I've fixed it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.