问题
The issue is nearly identical to Facebook Recommend Ignoring og:title Until Page Refreshed, but that never seemed to really be resolved (and the solution unfortunately did not help us).
We have thousands of pages with a programmatically-generated like button. The very first time I click on the like button, the appropriate og-tag information is not included in the popup, and the popup looks like (with URL redacted) http://imgur.com/nWffNY1,UCI76QV#1.
If I continually unlike and relike the page without refreshing, it is similarly broken. If I refresh the page, though, or even just call FB.XFBML.parse() from the javascript console, and re-like the page, the information is appropriately included, and looks like the other image in the above album (I don't have enough reputation to post 3 links :-( ).
Any subsequent attempt to like a page that has already been liked (even by someone other than myself) succeeds. If I enter the URL for an unliked page into https://developers.facebook.com/tools/debug, everything looks fine, and an attempt to then like the page successfully shows the information. It seems like once Facebook caches the information, things are good.
Any suggestions would be most appreciated!
回答1:
It seems like once Facebook caches the information, things are good.
Yes, of course – this is how it works.
When Facebook encounters a “new” URL, it sets its scraper on it to get the information from it. But in cases where this is triggered by the end user (like button, feed dialog, etc.), it may take “too long” for Facebook to get the info – and so they don’t have the UI wait for it, because they want a fast user experience.
What you can do about this (apart from making your server respond faster, should(!) it be the bottleneck in this [1]), is to programmatically ask Facebook via API to scrape your pages – ideally at the point where you add new content to your site, but you can also do it for pages that exist for a while already, but might not have been scraped yet.
How that’s done, is described here: Updating Objects. (If you plan to do this in larger quantities, from what I’ve heard it should be advisable to include an app access token with those calls, to avoid throttling.)
[1] If your server is the bottleneck because you are delivering large pages, you could also consider delivering the meta data for your pages under different URLs, so that the scraper has much less content to read from your server and maybe your server has less content to create in the first place – for that, see the same linked document, section “Handling Large Objects With Pointers”
回答2:
Ok so if after all that, you’re problem is still not solved then try turning off Gzip Page Compression. In my case I was using the W3 Cache plugin for WordPress that was compressing the pages with Gzip and effectively removing the tags.
If the solution provided by the best answer doesn't work for you, try this http://peterfields.me/facebook-share-ogtitle-string-error/
来源:https://stackoverflow.com/questions/17982880/facebook-like-button-doesnt-show-og-metadata-until-after-first-like