I am experiencing an odd and baffling problem which seems as far as I can tell to be panels related:

I am trying to get the 'open graph meta tags' module to work on my site so that the facebook like button works properly for individual nodes...

I have overridden my nodes with panels and they do not show any of the open graph meta tags in head whereas they do show when the panels are disabled

Any light that can be shed would be very much appreciated!

Comments

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Not knowing anything about that module, I can only guess that those metatags are added via hook_nodeapi of some flavor. That hook will only be run if the node: content pane is added to the page. Do you have this pane added?

leovw’s picture

Status: Postponed (maintainer needs more info) » Active

Hi Merlin - You are correct I haven't added node:content pane to the panel as the page instead currently comprises of a collection of views... Is there a way to add it but not show it that causes minimal performance degradation?

This is the function within the module which must be causing the problem:


function opengraph_meta_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'delete':
      OpenGraphMeta::instance()->delete_node_data($node->nid);
      break;
    case 'insert':
    case 'update':
      if (!empty($node->opengraph_meta)) {
        OpenGraphMeta::instance()->save_node_data($node->nid, $node->opengraph_meta);
      }
      break;
    case 'load':
      if (OpenGraphMeta::instance()->tags_are_enabled_for_content_type($node->type)) {
        return array('opengraph_meta' => OpenGraphMeta::instance()->load_node_data($node));
      }
      break;
    case 'view':
      // only show meta tags if viewing full node as a page
      if (NODE_BUILD_NORMAL == $node->build_mode && !$teaser && $page && !empty($node->opengraph_meta))
        OpenGraphMeta::instance()->render_data($node, $node->opengraph_meta);
  }
}

Thanks for you help

merlinofchaos’s picture

Sadly no, and there probably should be another way to do this, but there isn't. You could probably implement hook_ctools_render_alter() and do a node_invoke('view') on the node there, but that's kind of a pain in the butt since you've got to dig the node out of the context. It's not THAT hard, mind you.

Letharion’s picture

Status: Active » Closed (won't fix)

As has been cleared, hook_nodeapi doesn't get called unless you have the content in the pane. I posted to another issue a simple ctools plugin to specifically workaround this, but I don't remember which issue it is at the moment.

bradjones1’s picture

The issue mentioned by Letharion above is #1117156: How do I get og:image working with Panels?