Monday, February 20, 2012

Fix: Wrong Description and Image on sharing posts to Facebook


When you share a post on Facebook, it will display a thumbnail picked from the post page along with a short description of the post. But in many cases Facebook fails to  identify the correct image and description that it should use. This leads to irrelevant images and description coming up in Facebook when you or your readers share the post. This is totally annoying, and I had got many queries regarding this on my Facebook page and via email. So for those who are trying to figure a way out of this, here is the solution.

Which image and Description does Facebook pick from your Post Page

Facebook regularly scrapes your page and caches the data to your servers. They look for meta data information(Opengraph tags and others) in your post page. The meta data can explicitly specify the image and the description to use when the page is shared.If Facebook doesn’t find any meta data, then their Algorithms will fetch some description and image from your Page. Facebook shows a wrong description or image when their Algorithms are not able to fetch the correct image and description from your Post Page.
We will solve both of these issues using two different techniques.

1. Fixing the Wrong Image Problem.

You might have noticed that comment avatars, and other  irrelevant images come up when you share the post on Facebook . The solution to this is to specify the image in the page meta data. We will be using open graph tags for the same.
Go to Template > Edit HTML and just above
</head>
Paste the following code snippet.
<b:if cond='data:blog.postImageThumbnailUrl'>
<meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/>
<b:else/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9129hqnQm56vQvOHjZLjyPoAgziNYMqFC2JzGoKD0_UnyVrOaF2tOQh3HkdLOq2nx5WwLiluMaE4Q8ShvEkkBte_ICFMw2uLJ7KeLD5bdaat0FGu_nlNvEboLrkIS7MzdvgzWu6yKLcw/s72-c/default.png' property='og:image'/>
</b:if>
You can alter the image URL in the above snippet. That image will be used when no post thumbnail is present.
Now when you share posts to Facebook, a proper post thumbnail will be displayed. If the post doesn’t have images, then the fall back image which we have specified in the snippet will be used. If you don’t see results right away , then it is because of the caching done by Facebook. You can force Facebook to update the cache by debugging the post URL using this tool.

2. Fixing the Wrong Description Problem

Wrong description comes up when Facebook is not able to recognize the content and structure of your page. This also can be rectified by using meta data, but since blogger doesn’t provide a post snippet tag outside the blog post widget, it is impossible to do that using valid HTML. So we will have to go for other alternatives. If meta data is not found, then Facebook normally uses the First paragraph in your page(which is big enough). So it will be a good idea to get used to the paragraph HTML tag <p>content</p>. The Blogger Post Editor doesn’t use paragraph tags but uses lots of line break tags instead. So if you are using the Blogger Post Editor, then you will have to go into the HTML mode of the post Editor, and make sure that you use paragraph tags(I do agree that it is a difficult thing to do). If you can’t take that headache, then you can use a third party Publishing Tool like the Windows Live Writer which has superior Editing Controls. After doing this, you will again have to force a Cache refresh using the Facebook Debug tool and your post should show a proper description on Facebook.

3. Scripts coming up in the Facebook Description

I had seen a couple of cases where JavaScript snippets come up in the Facebook Description. Facebook somehow mistook the script for content, and this is probably because of the way you have added the script. Go to your template and see if there are any special characters in front of that particular script tag. If you find one, then remove it, and force a Facebook Cache Refresh.
If you found this tutorial useful, then do share it with your Facebook Friends who use Blogger :-). If you have any questions do ask here in the comments or the forum or on ourFacebook Page.

0 التعليقات:

Post a Comment