【像黑客一样写博客之七】分享功能

本文介绍如何将Octopress博客系统中的分享按钮替换为加网分享代码,包括获取分享代码、添加到Octopress的过程及配置说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原创作品,转载请标明http://blog.youkuaiyun.com/jackystudio/article/details/16838525


Octopress自带的分享代码是推特,脸书和Google+,这里改用国内的加网分享,添加方式和评论相似。


1.获取分享代码

进入http://www.jiathis.com,选择样式,点击获取代码。

比如我这里得到

[html]  view plain copy
  1. <!-- JiaThis Button BEGIN -->  
  2. <div class="jiathis_style_32x32">  
  3.     <a class="jiathis_button_qzone"></a>  
  4.     <a class="jiathis_button_tsina"></a>  
  5.     <a class="jiathis_button_tqq"></a>  
  6.     <a class="jiathis_button_weixin"></a>  
  7.     <a class="jiathis_button_renren"></a>  
  8.     <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>  
  9.     <a class="jiathis_counter_style"></a>  
  10. </div>  
  11. <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1367457337064293" charset="utf-8"></script>  
  12. <!-- JiaThis Button END -->  


2.添加分享

(1)进入Octopress\source\_includes\post,创建名为jiathis.html的文件,把上述代码拷入即可。

(2)进入Octopress\source\_includes\post,打开sharing.html,加入如下代码

[html]  view plain copy
  1.   {% if site.share %}  
  2.   <h2>Share</h2>  
  3.       {% include post/jiathis.html %}  
  4.   {% endif %}  

(3)屏蔽掉推特分享链接

在第一行推特分享的判断语句上 and false。

[cpp]  view plain copy
  1. {% if site.twitter_tweet_button and false %}  

(4)进入Octopress目录,打开_config.yml,加入

[html]  view plain copy
  1. #share                                                                                      
  2. share: true  

3.生成页面,推送

完成以上步骤后,执行

[cpp]  view plain copy
  1. rake generate  
  2. rake preview  
  3. rake deploy  


查看文章页面http://geekjacky.github.io/blog/2013/11/13/hello-github-blog/




4.推送source分支

[cpp]  view plain copy
  1. git add .  
  2. git commit -m "添加加网分享"  
  3. git push origin source  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值