All settings working as expected apart from the Page Title. It seems this is always ignored. Even setting to a static value is ignored. It will always output the default. I have tried setting in Global all the way through to 'by path' trying to see if it was I using incorrectly.

I have seen other issues mentioning this but they appear to have been patched or addressed.

I DID previously have the page title module installed but I removed and deleted before installing Metatags.

Any suggestions?

Comments

cyxair’s picture

I just ran into the same problem.

Fixed it by adding the following code to a hook_preprocess_html in my theme template.php file :

if(isset($variables['head_array']['title'])) {
	  $variables['head_title'] = $variables['head_array']['title'];
  }

I left this issue open, as I don't think this kind of trick should be necessary to use this module.

Dave Reid’s picture

Metatag should work out of the box with all core themes. What theme are you using? Maybe something else is a bit more non-standard elsewhere in the code?

cyxair’s picture

My theme is form Bartik.
I didn't see anything particular in template.php
While printing the $variables array in hook_preprocess_html(), I found out that the title generated by Metatag module was in $variables['head_array']['title'], and html.tpl.php was printing $variables['head_title'], so I came up with this piece of code to make it work.

serg2’s picture

I am using the Omega theme, version 4.
I queried the title settings earlier with the maintainer/creator of the theme and he said the title was set in the standard way: https://drupal.org/node/2126363

Would you like me to provide anything to figure this out or would you just suggest I use cyxairs solution(https://drupal.org/comment/8143383#comment-8143383)?

thanks

nlhnam’s picture

@cyxair: Your array not work in my code.
I have to put this: $variables['page']['content']['content']['content']['metatags']['global']['title']['#attached']['metatag_set_preprocess_variable'][0][2];

if (array_key_exists('global', $variables['page']['content']['content']['content']['metatags'])){
    $new_title = $variables['page']['content']['content']['content']['metatags']['global']['title']['#attached']['metatag_set_preprocess_variable'][0][2];
  }
  if (isset($new_title)){
    $variables['head_title'] = $new_title;
  }
DamienMcKenna’s picture

Status: Active » Closed (fixed)

Since v7.x-1.5 it has been possible to select with theme region is used to trigger the meta tag output, so this should no longer be an issue.