When the node page is running through a panel override, the open graph tags don't display.

In order to resolve this, I've had to change the following on line 200 of opengraph_meta.module:

if (NODE_BUILD_NORMAL == $node->build_mode && !$teaser && $page !empty($node->opengraph_meta))
OpenGraphMeta::instance()->render_data($node, $node->opengraph_meta);

to

if (NODE_BUILD_NORMAL == $node->build_mode && !$teaser && !empty($node->opengraph_meta))
OpenGraphMeta::instance()->render_data($node, $node->opengraph_meta);

Not sure why it needs the $page check, but perhaps there is a way to do this without losing that functionality. Could it not just do a direct check that we're actually on the node page (ie arg(0) == node and arg(1) == id)?

CommentFileSizeAuthor
#8 opengraph_meta_ctools-1214952-8.patch781 bytescedarm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guybedford’s picture

Actually a better fix is to use the following -

if (NODE_BUILD_NORMAL == $node->build_mode && !$teaser && arg(0) == 'node' && !empty($node->opengraph_meta))

Then it only applies to node pages.

haleagar’s picture

A node can be rendered as NODE_BUILD_NORMAL when it's not the primary node on a node page.
Either called in an embedded view, or more likely pulled from a Node reference on the primary node.
(a slide show, or author profile for instance)

therefore arg(0) == 'node' is not a sufficient check.

In fact using node panels it's quite possible that opengraph_meta_nodeapi is not even called on the primary node, but would be called on other referenced nodes.

yoonchee’s picture

Version: 6.x-1.5 » 6.x-1.6
Assigned: Unassigned » yoonchee

Add this to opengraph_meta.drupal6-hooks.inc

/**
 * Implements hook_ctools_render_alter to display opengraph meta tags in Panels.
 */
function opengraph_meta_ctools_render_alter($info, $page, $args, $contexts, $task, $subtask) {
  // extract node from context
  $node = $contexts['argument_nid_1']->data;

  if ($page && $node && !empty($node->opengraph_meta)) {
    OpenGraphMeta::instance()->render_data($node, $node->opengraph_meta);
  }
}
hiddentao’s picture

Does adding #3 (as @yoonchee suggested) work for people? I haven't yet got Panels installed locally.

hiddentao’s picture

stijnbe’s picture

#3 works with node panels.

djhspence’s picture

#3 worked for me too, thanks @yoonchee

cedarm’s picture

Status: Active » Needs review
FileSize
781 bytes

It does seem that #1233570: Meta tags never rendered when using Panels is a duplicate, but D7 instead of D6. I think that #3 is missing some checks that the D7 patch has. Also, I'm not certain if the foreach in the D7 patch is appropriate or not. We did not include it.

killes@www.drop.org’s picture

Status: Needs review » Reviewed & tested by the community

Works great

jemond’s picture

I can confirm the patch #8 works great.

jemond’s picture

Any chance we can get this committed?

torotil’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)

Hi,

I'm the new maintainer of opengraph_meta. Sorry for the long silence in the issue queue.

Sadly I don't have the resources to care for the Drupal 6 version. Unless and until someone steps up to maintain it I'm therefore closing all D6 issues as WONTFIX.

Feel free to re-open the issue if it is still valid in one of the Drupal 7 branches.

Thanks!