Can You Have Your OpenGraph Object Link to a Different URL? - facebook

So you need a public URL with meta tags to represent an object in the OpenGraph, and one of the required meta tags is a URL property. When the action gets published, it links to this URL property.
Let's say I'm on http://mysite.com/A. It seems like I can't then do this:
<meta property="og:url" content="http://mysite.com/B"></meta>
Because Facebook will try to look at the root url for the meta tags. Is there any way to link to a different URL (mysite.com/B) from a given OpenGraph object URL (mysite.com/A)?

You should be able to link to another URL. But all an og:url means is "go over to that URL and use the tags from there instead". You can either
1) put all your tags on A and then redirect users to B with JavaScript or User-Agent detection;
2) put your content on A and do an og:url to B.

#Paul, I didn't fully understand or appreciate your comment until now - apologies and thanks.
What I learned from a little more tinkering is that on the initial post to FB with the object item url in the post, is that FB then crawls that page, gets the META tags and if you've got og:url defined it will crawl it again. It crawls it twice.
In my case, I am passing a querystring that does get parsed, but I was not setting it again in the og:url, so when it crawled my page the second time, it was not picking up the querystring variable I needed it to.
That was a dumb thing on my part. Thanks for the great answer.
Jim

Related

How do I add query parameter to Facebook og:url meta tag without impacting ranking of my page?

I have a page which has open graph meta tags added to it. Now,I need to pass a query parameter to my page url, value of which will decide whether og:video meta tags has to be added to page or not. But as soon as Facebook crawler finds og:url, it ignores everything on the page and starts crawling canonical url given in og:url. If I add required query parameter to og:url, Facebook creates new indexing and my page ranking drops to 0.
For example:
Current Behavior:
My page url: http://www.example.com/mypage
with og:url value content="http://www.example.com/mypage"
New Behaviour which I want:
My page url: http://www.example.com/mypage?isValue=1
Page will have this check:
if isValue=1 , it will Add video meta tags on page
New page should have this og:url to propagate isValue=1 properly:
og:url content="http://www.example.com/mypage?isValue=1"
How can I avoid drop in my page ranking by new behaviour?
Is there anyway I can make Facebook crawl og:url with query parameter added to it without affecting my page ranking?
Any other way of doing what I need to do, would also be helpful.
That is the expected behavior. Facebook will always crawl the og:url aka the Canonical URL you are returning in your markup. Each URL is treated as a unique object, so if you are changing parameters, it will be a new object with 0 likes or shares.
It is also not considered good practice to have URL parameters as part of your canonical URL (see https://developers.facebook.com/docs/sharing/best-practices#tags)

Why non-canonical URL with a fragment identifier (#) is shared with a `_escaped_fragment_` query parameter?

I'm using Facebook's Share Dialog to share a URL like...
http://www.example.com/products/9-some-name#!23
In the HTML for that page, a different URL (also with a fragment identifier) is specified as the canonical URL, like
<link rel="canonical" href="http://www.example.com/products/9-canonical-name#!23">
<meta property="og:url" content="http://www.example.com/products/9-canonical-name#!23">
In my Facebook profile, the shared URL shows as
http://www.example.com/products/9-canonical-name?_escaped_fragment_=23
Is that a bug?
(I expected the shared URL to be posted as-is, i.e. not the canonical one, and without any transformation.)
UPDATE
After more investigation I realized this doesn't have anything to do with fragment identifiers. The essential problem is that the URL posted by Facebook in the user's profile is the URL in og:url, not the originally shared URL. And it seems that can't be changed (as I understand from a related question).
According to the documentation for sharing best practices on Facebook the the og:url should be a URL with no session id or extraneous parameters. All shares on Facebook will use the og:url as the identifying URL.
developers.facebook.com/docs/sharing/best-practices#tags

Facebook og:url redirect loop

So, we run a news site and the URLs for specific articles might change after the article has been published (the URL usually contains the article title).
To keep track of Facebook shares even when the URL changes, we've add the og:url property with the unique URL for the article (which is basically our domain, followed by the article ID).
The problem is, this unique URL redirects to the article page, so when I share the "pretty" article URL, I get a redirect loop.
Any ideas on how to workaround this issue?
Thanks!
Well, if you're setting the og:url parameter to anything other than the canonical URL for that content, you're misusing it.
The og:url tag tells Facebook where to go for the canonical metadata for a URL - if you're then redirecting elsewhere from that URL, it wasn't really the canonical URL - you should have set the og:url value to wherever is at the end of the redirect cycle, and put the article metadata there
if you need to track specific placements or clicks of the like button and the referral traffic from those, there's a ref parameter you can use for that which is passed back to you in the referral traffic, it's documented here: https://developers.dev.facebook.com/docs/plugins/like-button/#faqref

Difference between rel="canonical" and og:url?

I'm having trouble understanding canonical URLs with regards to how search engines and Facebook seem to handle them.
My Google maps powered site allows visitors to use social media to request a gig in their country. One of the pages in question can be found at: http://izzy.nogig.in/
When a user clicks on their countries marker it gives them sharing options (twitter/facebook/etc), which when shared will share the URL specifically for that country, eg: izzy.nogig.in/usa? or izzy.nogig.in/spain? etc.
All of these countries in the URL amount to a lot of duplicate content so I use the following to point search engines to the page I want ranked:-
<link rel="canonical" href="http://izzy.nogig.in/_?"/>
For Facebook Likes to count towards each individual country I've set my Open Graph "og:url" as follows, eg:
<meta property="og:url" content="http://izzy.nogig.in/australia?" />
Now when I run a country-specific URL through the Facebook Object Debugger (eg. http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fizzy.nogig.in%2Faustralia%3F) it shows the following:-
Response Code: 206
Fetched URL: http://izzy.nogig.in/australia
Canonical URL: http://izzy.nogig.in/australia
Mismatch og:url and canonical url:
og:url tag in the header is not the same URL as rel='canonical' link in the html.
The above error is what's confusing me. I know they're mismatched, but I thought this was the correct way to do this.
Everything in the debugger looks good to me (correct link, description, image etc for each country), and I can't change the rel="canonical" value to match my og:url as I need it pointing to a single page (country-less) for search engines.
I believe it is all working correctly. Should I just ignore the error from the debugger, or have I set this up incorrectly? I don't want "likes" for each country all disappearing and counting towards the rel="canonical" URL.
Many Thanks - Will
link rel="canonical" will be used by search engines where as og:url will be used by facebook
og:url basically tells the FB scraper "ignore anything on this page, and scrape this url instead"
More for Canonical link element: http://en.wikipedia.org/wiki/Canonical_link_element
Canonical urls refer to page content.
The target (canonical) IRI MUST identify content that is either
duplicative or a superset of the content at the context (referring)
IRI. rfc6596#3
Opengraph url refers to "object".
The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/". ogp.me
So they may be different. For example, for multi-language websites, page for each language should have distinct canonical url, because content is different, but usually the same og:url for all languages, because they refer to the same object described in multiple languages.
On one of the sites I've developed I serve the page in more than one language, and provide links to allow the user to switch between one language and the other. So, my rel="canonical" will have the URL http://www.example.com/, whereas, within the code I update the og:url so that it is either http://en.example.com/ or http://fr.example.com/. That way when the user shares the page on Facebook, everything will appear on Facebook in the language they were viewing the page, which makes sense since most of the visitor's friends will likely speak the same language.
Regards.
I see no reason why og:url and canonical should be different. In both circumstances you're saying to either the search engine or Facebook what page you want to index or be displayed.

Canonical OG URL fails in URL linter because of redirect

I recently changed domain name for my site and migrated my content. Most URLs from the old site use a 301 redirect to the new site, as you would guess.
In an effort to retain FB like and comment data, I kept the og:url property set to the old URL, since it is the original and canonical identifier in Open Graph. I implemented in August, and it was working properly, with previous like data retained. Now it is not working and showing previous like data, and fails in the URL Debugger.
Here is an example from the new site:
http://seattle.findwell.com/million-things-to-do-seattle/washington-brewers-festival-2011
In URL Debuggger, it now returns this error:
There was an error in fetching the object at URL 'http://seattle.findwell.com/million-things-to-do-seattle/washington-brewers-festival-2011/', or one of the the URLs specified via a redirect or the 'og:url' property including one of http://www.hometalkin.com/seattle/million-things-to-do-seattle/washington-brewers-festival-2011/.
Nothing has changed in my OG tags. Has something changed with canonical URL in open graph that causes it to fail when a redirect is in place?
This page:
http://seattle.findwell.com/million-things-to-do-seattle/washington-brewers-festival-2011
has this og:url:
<meta content="http://www.hometalkin.com/seattle/million-things-to-do-seattle/washington-brewers-festival-2011/"
property="og:url" />
but when you actually go to (in fact - when Facebook crawler tries to go to) this URL from og:url the site redirects you back to:
http://seattle.findwell.com/million-things-to-do-seattle/washington-brewers-festival-2011/
This is a circular reference.
In order to fix it you need to change your og:url to:
http://seattle.findwell.com/million-things-to-do-seattle/washington-brewers-festival-2011/
I actually had a very difficult time with this when I was first starting out as a developer.
I made a tool for this exact purpose -- as I thought it might be helpful to others:
Facebook/Open Graph Like Button Generator
It generates (and stores) the open graph tag(s) so you don't need to put them in your page and the 'Redirect URL' tells it where to send all the traffic.
It detects the Facebook bot/scraper too so it won't interfere with anything :)
Good luck
I had exactly the same problem.
I have changed my website url and I have over 40.000 radios with fb likes and comments.
Example:
http://www.radioways.com/fr/radio/nrj.html
to
http://www.radioways.fr/radio/nrj.html
I spend days and days reading and checking the forum and I did not find the answer...
Here is what to do:
1. In the og canonical, you need to put your old website url
2. In the Iframe url, you can put both. The result of the likes, will be the addition of the likes of the ogcanonical + the likes of the Iframe
An this will not work (and this is why I spent so much time USELESS) untill you validate those setup with FB
Best regards.