Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
6 Feb 2012 at 14:14 UTC
Updated:
15 Oct 2012 at 19:08 UTC
Hello,
First let me thank you for this module.
I'm having problems with the module metatags, my specific configuration for the instance "content" is not used when the page is rendered. I can only configure instances "global" and "global: frontpage".
For a node page, in the "metatag_page_build" function, I have metatags informations in the variable
$page ['content']['system_main']['content']['nodes'][PID ]['metatags']
but this information is never used in this function.
/**
* Implements hook_page_build().
*/
function metatag_page_build(&$page) {
// For some reason with Overlay enabled we get an empty $page, so just fail
// this case.
if (!isset($page['content'])) {
return;
}
// Load the metatags render array in before any page content so that more
// more specific meta tags in the page content can override these meta tags.
$page['content'] = array('metatags' => array()) + $page['content'];
if (drupal_is_front_page()) {
$page['content']['metatags']['global:frontpage'] = metatag_metatags_view('global:frontpage', array());
}
elseif (!path_is_admin(current_path())) {
// Do not output the global metatags when on an administration path.
$page['content']['metatags']['global'] = metatag_metatags_view('global', array());
}
}
Do you have any trouble like this ?
Comments
Comment #1
mmncs commentedI'm having the same issue.
Description, Keywords and title are not showing for content types.
Comment #2
poukram commentedI'm sorry, for me it's not a bug, I use custom templates and I solve the problem with this code :
I put this code in my nodes templates
See : http://drupal.org/node/1310780
Comment #3
marcoka commented#1386320: SOLUTION: Metatags in front not working
not a bug, it seems people use custom templates and remove variables where they dont know what exactly they are doing.
does it work with the core theme? if so, your custom theme removes page vars that it should NOT remove.
Comment #4
dcanetma commentedHi,
I'm needing to include some other ogp tags per content type on a project I'm working and faced the same issue as you.
I've managed to fix it, and I'm preparing a patch. Be patient, please.
Since I'm still not very good at managing issue queues here's the code, in case you need to fix that right away.
Comment #5
damienmckennaRather than hacking away trying to get this working, and ultimately building work-arounds for an existing work-around in Metatag, the output logic has been re-written thanks to jenlampton and I'm hoping it works better now. Please try the latest -dev release and please let me know if it works as-is, and re-open the issue if it's still not working.
That said, please be aware that right now it doesn't let you override tags for taxonomy term pages due to a core bug, please keep an eye on #1700160: Support taxonomy term pages until taxonomy supports hook_entity_view() for further updates.
Comment #6
damienmckennaRelated and honestly a higher priority: #1708718: Ensure Meta tags work OOTB with Drupal core
I'm going to fix that and then see how to resolve this issue.
Comment #7
marcelovaniCan you try this: http://drupal.org/node/1732538#comment-6528646
Comment #8
damienmckennaThis should work now, between the hook_entity_view change in #1363476: Panels integration - ensure meta tags work OOTB on entity pages, a matching change in the core logic in #1784896: Overriding meta tags fall back to parent default tag value and a stop-gap work-around for a missing hook for taxonomy term pages in #1700160: Support taxonomy term pages until taxonomy supports hook_entity_view(). If you are still having a problem specifically with the front page then it is a theming issue, please get involved with / follow #1800658: Front page settings don't work on some themes (e.g. TopHit).
Comment #9
damienmckenna