I have a Facebook like that links to a page on witch I don't have complete control: I can modify the <body>
but not the <head>
of the page...
So I tried to set the link of the like button on a new page on which I have complete control, set the opengraph metatags on this page, and set an og:url that links to the original page.
But in the end Facebook tries to extract metadata from the og:url and overrides the metatags of the previous page... Is it possible to tell that I want to scrape metadata from the first fetched url and not from the og:url ?
There is no way to instruct linter to extract OpenGraph metadata from page which have URL different than one defined in
og:url
.Linter will always extract the meta tags from URL defined in
og:url
at the end of the chain...There is a way to do something other (which may, or may not fit your needs):
You can create intermediate page that will have all the required OpenGraph including
og:url
pointing to that page (not the one you have no control over it). That page will only have meta-data and JavaScript/Meta redirect to the final page, so user who land this intermediate page will be redirected to the correct final page.Beware, this will associate all the likes not to the "final" page but to the intermediate one.
I think there is a bug in the Facebook Debug/linter, with regards to which URL can have the OG metadata. Your OG:URL should be canonical, which means this is the URL that should work today, tomorrow, and in ten years from now. Where as the url that was shared is temporal, and web developers can't guarantee that the "fetch" url will persist. Your canonical / og:url might redirect to the final destination that has og: tags.
But, the bug in the FaceBook linter is that its not following redirects past the og:url. i.e. http://example.com/persistant/123 where as that might just redirect to the friendly URL, such as http://example.com/year/month/title/persistant_123 . Perhaps someone from FaceBook can clarify their interpretation of "shall redirects be followed from the canonical URL".
Google's Opinion Google Webmaster Blog: Specify your Canonical
Current FaceBook Debug/Linter practice is to stop once its reached the OG:URL, and not follow standard HTTP redirects to get to the OG tags. I think Google's definition of Canonical is more, well.. canonical of what web developers are expecting.