The Open Graph Protocol enables web pages to integrate into social graph. For example, if you include open graph tags, you will have the ability to treat your page same as Facebook Page. In addition, if you have added Plus One button to Blogger, it can also help you to get your +1ed page to be integrated in to the social graph of Google+.
To enable it you need to add <meta> tags. In this tutorial I will tell you how to add these Meta tags to Blogger so that Facebook, Google+ and other social networking sites can collect the structured information about your blog and post pages.

Before we start, let’s discuss about important Meta tags that can/should be included to Blogger.
og:title
<meta expr:content='data:blog.pageName' property='og:title'/>
Object Title, i.e., the title of the page or post.
og:type
<meta content='blog' property='og:type'/>
The type of object, i.e., it is for homepage and other pages expect blog post (item) and static pages, and:
<meta content='article' property='og:type'/>
Used for post and static pages only.
The type for the object should be used properly because it can create some problem.
og:url
<meta expr:content='data:blog.canonicalUrl' property='og:url'/>
The URL of the page the user is reading.
og:image
<meta content='http://www.your-blog-logo.jpg' property='og:image'/>
The image that should be used to represent the object. Many have asked that “I want to show my blog’s logo when people Like my post”. There are also some other problems, e.g., the image does not appears or the post image is not displayed correctly when the post is Liked. This tag solves these types of problems for Blogger.
Update (12/7/2011): Now it's possible to add Blogger post images to og:image. Thanks to alt.pathawks.com.
<b:if cond='data:blog.postImageThumbnailUrl'> <meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/> <b:else/> <meta content='http://www.your-blog-logo.jpg' property='og:image'/> </b:if>
I did some changes to the original code so that if your blog posts or other pages do not contain any images, it will render a default image instead. Replace “http://www.your-blog-logo.jpg” with your blog’s logo image, which should be more than 50x50 pixels with maximum aspect ratio of 3:1 and should be in PNG, JPEG and GIF formats. The image generated from data:blog.postImageThumbnailUrl will be 72x72 pixels.
If you think that the Like button works perfectly and you want to show images as it is added to the post, then you don’t need to add this tag.
og:site_name
<meta content='Your Blog’s Name' property='og:site_name'/>
The title of your blog. You have to replace “Your Blog's Name” with the title of your blog.
og:description
<meta content='Description of the page' property='og:description'/>
It is for having a small description of the page. Currently, getting dynamic description on Blogger is not possible through correct method. I have tried it with data:post.snippet method but it doesn't work between head tags and is also very short. It's now becoming crucial to have dynamic description on Blogger. It's my request to Google Blogger developers to enable it for us.
Update (12/8/2011): I suddenly noticed <meta expr:content='data:blog.metaDescription' name='description'/> tag to the head section. It was not there in previous templates and didn’t find any documentation also. May be Blogger is bringing a good news for us!
fb:admins
<meta content='Your-Facebook-Profile-ID' property='fb:admins'/>
This is optional. This is for Facebook Open Graph, you can choose whether to add this meta tag or not. You have to provide your Facebook profile ID in place of “Your-Facebook-Profile-ID”.
fb:app_id
<meta content='Your-App-ID' property='fb:app_id'/>
This is also optional as it is required if you have signed up for Facebook Apps. Replace “Your-App-ID” with the application ID given by Facebook.
How to Add Open Graph Meta Tags to Blogger
Step 1: Go to Blogger’s Dashboard > Layout > Design > Edit HTML tab.
Step 2: Find the HTML attribution marked in bold:
<html ...... xmlns:expr='http://www.google.com/2005/gml/expr'>
After this add the Open Graph Protocol name namespace:
xmlns:og='http://ogp.me/ns#'It will look like:
<html ...... xmlns:expr='http://www.google.com/2005/gml/expr' xmlns:og='http://ogp.me/ns#'>
If you have previously added the Facebook namespace as instructed in the tutorial for adding XFBML Facebook Like button to Blogger then the full attribution will look like:
<html ...... xmlns:expr='http://www.google.com/2005/gml/expr' xmlns:fb='http://ogp.me/ns/fb#' xmlns:og='http://ogp.me/ns#'>
Step 3: Find <head> and below it add the following META tags:
<b:if cond='data:blog.pageType == "item"'> <meta expr:content='data:blog.pageName' property='og:title'/> <meta expr:content='data:blog.canonicalUrl' property='og:url'/> <meta content='article' property='og:type'/> </b:if> <meta expr:content='data:blog.title' property='og:site_name'/> <b:if cond='data:blog.postImageThumbnailUrl'> <meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/> <b:else/> <meta content='http://www.your-blog-logo.jpg' property='og:image'/> </b:if> <meta content='Your-App-ID' property='fb:app_id'/> <meta content='Your-Facebook-Profile-ID' property='fb:admins'/>
For advance use
It creates some controversy to when to use blog to property og:type because as told in Facebook, it should be used on the root of a domain and article should be used when it represents a news article, blog post, photo, video, etc. So the META tags that can be added (with caution):
<b:if cond='data:blog.pageType != "item"'> <b:if cond='data:blog.pageType == "static_page"'> <meta expr:content='data:blog.pageName' property='og:title'/> <meta content='article' property='og:type'/> <b:else/> <meta expr:content='data:blog.pageTitle' property='og:title'/> <meta content='blog' property='og:type'/> </b:if> <b:else/> <meta expr:content='data:blog.pageName' property='og:title'/> <meta content='article' property='og:type'/> </b:if> <meta expr:content='data:blog.canonicalUrl' property='og:url'/> <meta expr:content='data:blog.title' property='og:site_name'/> <b:if cond='data:blog.postImageThumbnailUrl'> <meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/> <b:else/> <meta content='http://www.your-blog-logo.jpg' property='og:image'/> </b:if> <meta content='Your-App-ID' property='fb:app_id'/> <meta content='Your-Facebook-profile-ID' property='fb:admins'/>
Step 4: Save your template.
To check if you have applied all the <meta> tags correctly to Blogger, visit Facebook Debugger for Developers.
More references:
23 comments:
Thanks ! But the image is till the same for each post =/
As mentioned within the post that META property og:image should only be used when Facebook is showing a different image that you don't want to be shown or if you want to show your blog logo only. If you don't need it, either remove or don't use it.
yes OK thanks a lot!
hey admin please help me........
I wanted to know that after adding this code in head section, what else to be added in html section of blog post so that my blogpage is integrated with my facebook profile
The above meta tags are just enough.
Raju,
Thanks for heads up on <meta expr:content='data:blog.metaDescription' name='description'/>!
It will come in handy. :)
This post is quite handy, helped me understand the Timeline Graph in just tens of minutes, thanks a lot for sharing
Hey! I have done the all but it gives the result that i want but with error. Plz tell me by checking this url in debug
( www.letmeclear.com )
Where the problem is occurring? I didn't find any in the source!
I am having issues posting my Blogger posts to my Facebook wall. After doing some reasearch I have come across this page and see you offer a solution. However, I do not know where to start! I need to make the changes in the 'For advance use' section but do not know where to add the meta tags you have written the code for or how and where I should be adding my own names into the bold areas. Please can you offer me some guidance, in simple English ;) Many, many thanks!
Thanks for this long tutorial. I hope this will help my blog to get index properly.
Raju, why the gifs or videos don't creates thumbnails when facebook users share my posts?
sorry about my bad english.
Thanks for help me :)
@Handmade
Add it after <head> while you are editing your template.
@nlembronfiz
As far as I know Facebook doesn't support animated .gif. Regarding videos, it would get generated if the video generates a thumbnail, for example, YouTube videos.
Hi,
I placed all the tags as you instructed, can you please let me know what I am missing because it seems that the like or send buttons under each post are still not showing the proper content? Thanks in advance.
It's because there's no proper way to pull out the description (till now) through meta tags. However, you can try this: Solving Facebook description problem
Thanks for all this, But
Which App id I should enter?
Its Facebook's App ID. Read the post, I've explained it.
How would you use the og:audio metatag?
I don't know your purpose but for a simple one, this will do the job:
<meta content="http://example.com/example.mp3" property="og:audio" />
For full list, get it here: http://developers.facebook.com/docs/opengraph/music/
Hello,
Thank you so much for your tutorial. I wish I was smart enough to use it! :o) I tried your instructions very carefully, the only thing I did not use was FB App ID (left that line out) because I have not signed up for that. I ran the debugger and this is the message I received. Please help! I had no problems until yesterday using the Share feature for Blogger. Even all my older blog posts will "Share" correctly with the title and thumbnail, it is just any new posts that do not share properly. Do you know why that would be? Here are the errors:
Critical Errors That Must Be Fixed
Bad Response Code: URL returned a bad HTTP response code.
Errors That Must Be Fixed
Missing Required Property: The 'og:url' property is required, but not present.
Missing Required Property: The 'og:type' property is required, but not present.
Missing Required Property: The 'og:title' property is required, but not present.
Open Graph Warnings That Should Be Fixed
Inferred Property: The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property: The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
URLs
Graph API: https://graph.facebook.com/10150595363841647
Scraped URL: See exactly what our scraper sees for your URL
I've got it working now if I manually add the video url to the HTML code, but it's a pain to have to do that for every video I embed. How would you set this up to happen automatically?
@Lace
You are missing the steps 1 and 2. You need to add it as mentioned in the tutorial to fix this error.
@Myron
For each and every video that you post? Then I'm afraid that getting audio and video OGP for every post would be a pain for everyone as there are no proper ways to dynamically add video OGP tags to Blogger (at least, I didn't came across any). If I come across any such possible ways, then I'll post an update.
Post a Comment