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.
Comment | File | Size | Author |
---|---|---|---|
#30 | metatag-n1918706-30.patch | 731 bytes | JeroenT |
Comments
Comment #1
DamienMcKennaHow is the page title configured on the variant itself?
Comment #2
mpdonadioTitle 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.
Comment #3
DamienMcKennaAt 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.
Comment #4
mpdonadioChanging 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.
Comment #5
DamienMcKennaI 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.
Comment #6
theunraveler CreditAttribution: theunraveler commentedI 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.
Comment #7
devuo CreditAttribution: devuo commentedThe module is not deprecated, the module has been merged with metatag module. This issue now belongs there.
Comment #8
gregglesBetter status, I think.
Also following.
Comment #10
DamienMcKennaThis fixes a) the file path, b) using $info['title'] instead of $metatags['title'].
Comment #11
DamienMcKennaThis is more of a bug than a task.
Comment #12
DamienMcKennaHow's about this instead? Just set the page title if one was assigned.
Comment #13
devuo CreditAttribution: devuo commentedSeems okay with me!
Comment #14
beowulf1416 CreditAttribution: beowulf1416 commentedI 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.
Comment #15
DamienMcKenna@beowulf1416: What is the panel's title set to? Did you try the patch?
Comment #16
beowulf1416 CreditAttribution: beowulf1416 commentedJust read the reply now. The panel's title is set to 'No Title'. I will try the patch and feedback later. Thanks.
Comment #17
MustangGB CreditAttribution: MustangGB commentedDidn'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.Comment #18
Zekvyrin CreditAttribution: Zekvyrin commentedI'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 .
Comment #19
Zekvyrin CreditAttribution: Zekvyrin commentedSorry 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.
Comment #20
Zekvyrin CreditAttribution: Zekvyrin commentedComment #21
jerry CreditAttribution: jerry commentedThe patch in #19 appears to be working fine for me.
Comment #22
DamienMcKennaComment #23
mariusm CreditAttribution: mariusm commentedPlease add patch #19 to dev.
Thanks
Comment #24
scotwith1t+1 for committing #19. works for me.
Comment #25
scotwith1tComment #26
DamienMcKennaRemoved errant spaces at the top of the patch.
Comment #27
DamienMcKennaSorry, was just doing a test for a local user group. Thanks for the patch, I'll review it shortly.
Comment #28
lpalgarvio CreditAttribution: lpalgarvio commentedworks great
Comment #29
JeroenTI applied this patch, and it works great, except when I have a title with an &, it shows & amp;
Comment #30
JeroenTHow about something like this?
Comment #31
rroblik CreditAttribution: rroblik commented#30 working fine,
Will we see this patch in the recommanded version (
7.x-1.0-rc1
) ?Comment #32
DamienMcKenna@rroblik: 1.0-rc1 was already released, so it wasn't added. Maybe for the next release.. =)
Comment #33
DamienMcKennaA question for anyone who has tried this? Are tokens still processed in it, e.g. [site:name]? (I haven't tested it yet)
Comment #34
DamienMcKennaCommited. Thanks everyone!
Comment #35
JeroenTGreat! Just one nitpick, my username is JeroenT instead of JeroeT :-)
Comment #37
DamienMcKennaJeroenT: Sorry about that, I've fixed it.