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.
We're using panels to override the node view, and when that panel is enabled, no Open graph tags are shown. If I disable the panel, all tags show up.
The reason is that hook_node_view never gets called when Panels renders the node.
Comment | File | Size | Author |
---|---|---|---|
#7 | hook-ctools-render-alter-1233570-7.patch | 896 bytes | jantoine |
#2 | opengraph_meta_ctools_1233570.patch | 864 bytes | blackdog |
Comments
Comment #1
blackdog CreditAttribution: blackdog commentedI did a little research and found this little hook: ctools_render_alter(), which seems to do the trick, so I've added this snippet to opengraph_meta.module:
Not at all sure this is the preferred way, but seems to do the trick of getting the meta tags out.
Comment #2
blackdog CreditAttribution: blackdog commentedHere's a patch that includes the above, slightly improved. I see that Context module uses this hook as well, so I guess it's the preferred way.
Comment #3
Allan Walker CreditAttribution: Allan Walker commentedHi!
I'm having the same issue with panels, I'm trying to apply this and it doesn't seem to work. Have you encountered any other issues with this? I'm running Panels 7.x-3.0-alpha3 and ctools 7.x-1.0-rc1 if that makes any difference.
Comment #4
hiddentao CreditAttribution: hiddentao commentedAppears to be duplicate of #1214952: Open graph not displaying on node panel pages.
Comment #5
ivarvd CreditAttribution: ivarvd commentedI'm having this problem as well, the patch doesn't work for me.
Comment #6
sam3k CreditAttribution: sam3k commentedNot working for me. Placing some prints on the snippet shows that $context['contexts'] is empty. Can anyone tell me what this is and how to make it populate?
Comment #7
jantoine CreditAttribution: jantoine commentedUpdated patch against latest 7.x-1.x-dev branch.
Comment #8
rbrownellUpping the priority of this... Lots of sites use Panels to control the display of nodes because it offers tremendous flexibility and control.
Comment #9
danquah CreditAttribution: danquah commented#7 worked for me. I've tested against both 1.3 and 1.x-dev
Open Graph meta tags is the first result on google when searching for D7 and opengraph, and as panels are very popular it would be really nice to have this patch in as soon as possible. Also, as far as I can see it won't break any backwards compatibility as it is merely introducing a ctools specific hook.
Thanks a lot for the patch!
Comment #10
caspervoogt CreditAttribution: caspervoogt commentedI couldn't get patch #7 to work, though it applied cleanly. Not sure it matters but I am also running the Metatag module (7.x-1.4), but with the metatag_panels submodule disabled. Running Ctools 7.x-1.4. As a quick fix I added this into my html.tpl.php;
.. in the head section. At least this way I can control the default og:image, which was all I really needed to do.
Comment #11
torotil CreditAttribution: torotil at more onion commentedThe new version of opengraph_meta (7.x-2.x) uses metatag to store and render the metatags.