The First Cry of Atom Today is the first day of the rest of my life.

Optimize octopress for facebook post

This blog made by octopress, ruby CMS tool. As many others do, I also combined this tool with GitHub pages But this method has one fault about posting on facebook. Octopress doesn’t include ogp properties as default. Ogp properties privide facebook meta information such as title, author, description and url. So without this meta information, you cannot get proper images when you write a post on facebook. In order to attach thumbtail image to your post, you have to write some configuration on octopress.

Write appid and locale

Append below configuration in your _config.yml

facebook_app_id: YOUR_APP_ID
facebook_locale: ja_JP

YOUR_APP_ID might be listed on /source/_include/facebook_like.html Paste that number.

Change facebook like action

Edit /source/_include/facebook_like.html like below. This modification makes this JavaScript code get app_id and locale from _config.yml file.


Add top page flag

To ditinguish post articles and top page, add this flag to source/index.html

---
layout: default
index: true  
---

Configuration for ogp meta informations

Write below meta tags to source/_includes/custom/facebook_ogp.html

% cat source/_includes/custom/facebook_ogp.html
<meta property="og:title" content="Optimize octopress for facebook post - The First Cry of Atom" >
<meta property="og:description" content="" />
<meta property="og:url" content="http://lewuathe.com" />
<meta property="og:image" content="http://www.lewuathe.com" />
<meta property="og:author" content="lewuathe" />
<meta property="og:site_name" content="The First Cry of Atom" />
<meta property="og:locale" content="" />
<meta property="og:type" content="article" />
<meta property="fb:app_id" content="" />

Include meta tags

At last, make header include these meta tags. Write below on source/_include/head.html

So that’s all. It’s ok. Deploy this site and post any entry to facebook.

Good, you can see your thumbnail. A research shows that the post that has thumbnail images attracts more people than the post that has no image can. If you are using octopress for writing your own blog, it must be the good option for increasing the access from facebook.

Thank you.