Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Running dev due to this issue - http://drupal.org/node/1722638
I've set up a page title pattern for a content type like so: [node:title] | Consultants | [site:name]
It's a management consultancy website and I want the consultants pages to have a page tile with; Consultants name | Consultants | Site name
The page title pattern is set globally and when I edit the node I see the aforementioned pattern, but the resulting page title on save is just [node:title] | [site:name].
Am i missing something?
Comment | File | Size | Author |
---|---|---|---|
#23 | 1732538-23-page-title-pattern.patch | 1.07 KB | lathan |
#21 | 1732538-21-page-title-pattern.patch | 760 bytes | lathan |
#20 | 1732538-20-page-title-pattern.patch | 1.11 KB | lathan |
#12 | metatag-n1732538-12.patch | 495 bytes | DamienMcKenna |
#2 | Screen Shot 2012-08-15 at 16.28.44.png | 58.21 KB | hixster |
Comments
Comment #1
Dave ReidYou need to change the default page title for your node meta tag configuration, not the global configuration.
Comment #2
hixster CreditAttribution: hixster commentedHi Dave,
Er, just checking, think I was actually referring to the master metatags settings page when using the word 'global' there.
Whilst debugging I changed my settings on the node itself, but also in admin/config/search/metatags
I thought I would need to set the rule 'globally' in admin/config/search/metatags, as this is where the content types get their configuration settings form.
Then i assumed, this could be overridden on a per node basis by setting the page title on the node itself.
I've added some attachments to confirm my settings.
Comment #3
sovarn CreditAttribution: sovarn commentedI can confirm the same problem - running on alpha8.
Even though the settings page shows there is an override for my node type. I even go into the node edit form, the metatags tab shows correctly what the title should be.
Clearing cache and resaving doesn't make a difference - the page title is still the global setting.
Comment #4
hixster CreditAttribution: hixster commentedHi Dave, any thoughts on this?
Comment #5
hixster CreditAttribution: hixster commentedchanging to active
Comment #6
DamienMcKennaWill try to fix this for the next release.
Comment #7
DamienMcKennaIncidentally, are other meta tag changes on that node showing up, or is it just the title? What are you using to display the node - normal templates, Panels, Display Suite, etc?
Comment #8
sovarn CreditAttribution: sovarn commentedI am just using the normal template.
It does seem to only be a problem with the page titles. The keyword, description, copyright etc meta tags work fine when I override defaults in the node edit form.
Oddly, I just noticed my 'blog post' content type works correctly, whilst all my other content types do not.
I will do more exploring to see why that is.
Comment #9
Salih CreditAttribution: Salih commentedI have similar/same issue with my site www.threeyem.com
when I was running with Drupal6 all my SEO modules working properly and page-title was showing well. After upgrade to Drupal7 all content page-title shows only default value. But in Page-title configuration I left blank for all content type and checked 'show field' so I can give my own page-title. In node edit form I can see the values once I gave in Drupal6, but unfortunately it doesn't show that value instead it generates default Global value.
for example please check this page: http://www.threeyem.com/printing_services/rubber-stamp-no-1-company-seal...
Comment #10
hixster CreditAttribution: hixster commentedIt's just the page title for us. Other tags seem to be working. We're using fusion theme, no custom template mods, display suite etc.
Comment #11
jkempff CreditAttribution: jkempff commentedI am having the same issue with alpha8 on a mothership subtheme.
Interesting is that the $page variable in my page.tpl.php contains the overridden - correct - title attribute ($page['content']['metatags']...).
Comment #12
DamienMcKennaCould someone else please test this for me? I believe it resolves the problem by basically only accepting the first value for each $hook:$variable combination, but I want to be sure this is the right way of handling it. The oddity is that on a normal page load (no use of Panels) the head_title variable is being set three times - the first time with the per-object values, the second with the global default values, and the third again with the per-object values - this doesn't make sense to me and I will need to dig further to find out why.
Comment #13
Dave ReidThe order in which the meta tags are added to the page array are *very important* since it determines which things run "last" and hence are the output values.
Comment #14
DamienMcKennaOk, then there's something strange going on. Try adding this to the top of metatag_set_preprocess_variable:
First off, it should show an even number of outputs, one for the head_title and one for the head_array, but the first head_title doesn't show.
Secondly, the *first* values that show on the page are the correct per-object versions, the second values are the incorrect global values. When using the built-in taxonomy term page display a third set of head_title/head_array values are output which show the correct per-object versions, but this doesn't happen when using the Panels taxonomy_term page display (with the patch from #1760584).
Suggestions on the direction to take? Am I right in thinking that changing to use hook_entity_view changed means that the correct values load first and that subsequent loads should be discarded?
Comment #15
DamienMcKennaOk, my solution doesn't work, it doesn't pull in the per-entity override of the global title value, instead it just loads the defaults - the key problem is a deeper architectural problem. Note, this does not affect other meta tags, which work correctly, only the page title is affected.
Comment #16
DamienMcKennaThis works, but seems wrong:
Comment #17
DamienMcKennaA suggestion from another issue: change the weight of the global tags to -1.
Comment #18
hixster CreditAttribution: hixster commentedWhere should this setting of -1 be applied?
Comment #19
pyxio CreditAttribution: pyxio commentedsame problem here. where do i change the weight? cheers Kevin
Comment #20
lathanputting the solution in #16 into a patch that we can use this for now as that seems to work for us right now.
Comment #21
lathanjust removing debug i had left in
Comment #22
marcelovaniI found that 'global' was overriding metatags saved on nodes.
I fixed it by editing the following function and moving this line:
$page['content'] = array('metatags' => array()) + $page['content'];
to the bottom as you can see below:
Let me know if that fixes it for you.
Comment #23
lathan@marcelovani idea works better than the patch i had here is a patch file of the change, tested and works for me.
Comment #24
jmart CreditAttribution: jmart commented#23, please see my comment on another thread. I think the problem is with the ! operator. Not the placement of t
$page['content'] = array('metatags' => array()) + $page['content'];
http://drupal.org/node/1784896#comment-6526120
Also adding
$page['content'] = array();
may be heavy handed because there could be other stuff in that array and you are in effect removing the other elements, no?
Comment #25
marcelovaniThere are many issued regarding the same problem.
Thanks for the patch, but after some tests I noticed that the front page array still gets overridden, so the best idea is to use array_merge
Check this patch for dev version
http://drupal.org/node/1784896#comment-6528326
Comment #26
DamienMcKennaWaiting to see if the problem is resolved by #1784896: Overriding meta tags fall back to parent default tag value.
Comment #27
saitanay CreditAttribution: saitanay commentedThis may be an issue of your theme as well
I had the same issue where the title tag alone was being ignored.
I found that the custom theme that I was using was in doing the below in themename__preprocess_html(&$vars) function in template.php
$vars['head_title'] = drupal_get_title();
Removing the mentioned line solved the issue.!
Comment #28
lathan@DamienMcKenna applied metatag-n1784896-13.patch and metatag-n1700160-29.patch those did not resolve this issue for us.
@saitanay our theme does not contain any setting of head_title in template.tpl.php
Comment #29
marcelovani@jucallme can you try this patch http://drupal.org/node/1784896#comment-6534684
Here is the direct link http://drupal.org/files/overriding-metatags-fall-back-parent-default-val...
Let me know if that fixes it
Comment #30
lathan@marcelovani that patch is also not working for us.
Comment #31
marcelovani@jucallme that's weird, on http://drupal.org/node/1732538#comment-6526074 you said it worked for you and http://drupal.org/node/1784896#comment-6534684 doesn't.
The patch I sent to you fixed all our problems with overriding global node and term titles.
I am wondering if you got any module that does drupal_set_title after metatag.
Comment #32
lathan@marcelovani i had applied metatag-n1700160-29.patch and your patch http://drupal.org/node/1784896#comment-6534684 that did not resolve the issue the global pattern is not getting overridden for us.
We are running http://drupal.org/project/panelizer (thats not talked about here) i think that also messes with the page title.
Comment #33
marcelovani@jucallme its possible, any module that runs after metatag can override the title. Try to disable the modules, one by one, clearing the cache, to see if you can find the culprit.
You could set the weight of metatag to 10000 to make it load after all other modules.
Have you tried to use metatag (with and without patching) on a new drupal installation to see how it behaves?
Comment #34
DamienMcKenna@jucallme: Does your theme use a base theme? Have you overridden the html or page template files for your site? What are you using to generate the page output - normal templates, Views, Panels, etc?
Comment #35
DamienMcKenna@jucallme: Because you are using Panelizer you will need to patch CTools as well, please see the Panels support issue for further details.
Comment #36
lathan@DamienMcKenna thanks
so this recipe seems works for us
metatags:
- metatag-n1784896-13.patch
- metatag-n1700160-29.patch
ctools:
- ctools-n1760578-5-d7.patch
- ctools-n1760384-13-d7.patch
- ctools-n1760584-3-d7.patch
Comment #37
navinkmrsingh CreditAttribution: navinkmrsingh commentedI applied the metatag patches (mentioned in #36) but not the ctools patches as I my Page Manager is uninstalled.
But the problem still persists.
Any Idea??
Comment #38
DamienMcKennanavinkmrsingh: What pages are not showing the title correctly - homepage, nodes, terms, users, etc? What is being used for the page display?
Comment #39
DamienMcKenna@jucallme: Please try the newest patch on #1760578: Update user_view.inc to execute all normal Drupal hooks, it fixes a typo I let slip in. Also, please post comments on those issues if you've verified each page/entity type works correctly with the patches. Thank you.
Comment #40
DamienMcKennaMarking this as a duplicate of #1784896: Overriding meta tags fall back to parent default tag value though I suspect some of the other issues currently fixed may be part of the problem too.
Comment #41
chrisnovak CreditAttribution: chrisnovak commentedI had the same issue as saitanay, my theme was overriding the head title. Removing the following line from mytheme_preprocess_html() fixed the issue of no head titles displaying correctly:
$vars['head_title'] = variable_get('site_slogan', 'We <3 APIs') . ' ' . (isset($page_title)? $page_title : '') . ' | Apigee Developer Portal';
Comment #42
DamienMcKenna