Force Facebook to pull latest page content in the share dialog
Posted 07/18/2014 by Debabrata Biswas
Facebook parses open graph tags like <og:title>, <og:image> as meta tags in the page, and uses these values in the share dialog. What I found was Facebook expects the image specified in <og:image> tag to be of the same width and height. If an image with equal height and width is not specified,Facebook will use a random image form the page for the thumbnail of the share dialog.
Once you share a page (like http://www.facebook.com/sharer/sharer.php?u=[my page url]) with the open graph meta tags, Facebook caches its content for a few days. So suppose you have filled the open graph meta tags using your Sitecore context item's fields like "Title", "Subtitle, "Dec", "Image" and then you change one of these, publish the item and expect these to be reflected on the Facebook share dialog immediately, you would be disappointed like me. Of course there are these two ways of clearing the FB cache:
(a)- go to "https://developers.facebook.com/tools/debug", enter the page url and click on "debug".
(b)- Go to "https://www.facebook.com/sharer/sharer.php", enter the page url and click on "share".
private void ForceFBUpdate(SC.Web.UI.WebControls.Placeholder mPH)
StringBuilder sb = new StringBuilder();
Literal literal = new Literal();
literal.Text = sb.ToString();