Add Weibo Support to Octopress Blog

Posted by Lawrence Sun on 2014-01-09

Since I will go back China very soon, I think adding a Weibo link on the sidebar might be a good move. To be honest, I am not too keen on Weibo. The reason? Information overload.

  • First, add following code to “/source/_includes/header.html”
1
2
3
{ % if site.weibo_user % }
<a class="weibo" href="http://www.weibo.com/{{ site.weibo_user }}" title="Weibo">Weibo</a>
{ % endif % }
  • Second, add following code to “/sass/parts/_header.scss”
1
2
3
4
5
6
7
&.weibo{
background: image-url('social/weibo.png') center no-repeat #e32529;
border: 1px solid #e32529;
&:hover{
border: 1px solid darken(#e32529, 10%);
}
}
  • Then, add the “weibo.png” to “/source/images/social” dirctory.
  • Finally, add following code to “_config.yml”
1
2
3
# Weibo
weibo_user: ylsun # 微博数字 ID 或域名 ID
weibo_share: true

Thanks for sharing Allen