The og:url meta tag was added in #983512: New meta tags, but it cannot be overridden on a per-node basis. The URL should be a text field that can be overridden just like Title or Summary.
I can hear you thinking, why in the world would you want to replace the node URL for og:url?
There's one particular reason: if you have a webform that redirects to a thank you page after submission, the og:url on the thank you page will, of course, refer to the thank you page.
So, let's say I have a webform node at /survey, and after submitting the survey form, the user is redirected to /thanks-completing-our-survey. If they click a Facebook Like button on that page, they will be sharing the 'thank you' page instead of the actual survey form. It would be preferrable if the admin could override the URL meta tag, so that the URL field on the 'thank you' page would be set to the path of the survey node.
Comments
Comment #1
pal4life commentedHere is another example.
On this page , http://www.dosomething.org/programs/awards we would like the wall to have a different url than the one in template but it is not possible since we cannot edit it on per node basis. Also the og:image needs to be custom.
Comment #2
hiddentao commentedAdded a new hook in latest dev release: og_tag_render_alter
Documentation in opengraph_meta_test_module.module
Comment #3
supermoos commentedHow can I use this to change the url proptery to eg. example.com? I looked in opengraph_meta_test_module.module, and then I added this to my template.php file:
function hook_og_tag_render_alter($node, $name, $value){
return "testurl";
}
This is not working, could anyone point me in the right direction?
Comment #4
BrockBoland commented@supermoos: Since it's a hook, it needs to be implemented in a module. You'll need to create a new module, put the function in the .module file, and replace
hookwith the name of your module. So, if you call the moduleog_url_override.module, for example, the contents of the file would look like this:Comment #5
rwohlebThe hook lets me fix the frontage URL as described in #1496008: og:url has wrong value for site frontpage.
Comment #7
torotil commentedSeems that this has been implemented / committed long ago.