小鹏的技术博客

求索

Hi,我是小鹏,Java/iOS/Android开发者!


希望在这里记录一些自己对技术的学习和思考,欢迎交流!

Ocotopress个性化配置

1、添加个人域名

octopress目录下,执行命令:

echo 'yourdomain.com' >> source/CNAME

此命令会在octopress的source目录创建一个名为CNAME的文件文件,内容为yourdomain.com,完成之后,执行如下命令将CNAME部署到github:

rake generate
git add .
git commit -am "add CNAME." 
git push origin source
rake deploy

然后在你的DNS服务商,如 dnspod.cn,添加相应的CNAME指向 yourname.github.com。如果你要使用顶级域名,如 http://yuxiaopeng.com 访问你的博客,则需要使用A记录指向 204.232.175.78

详细内容请参考:Custom Domains

2、安装主题

本博使用shashank的greyshade主题,在终端中执行如下命令:

$ git clone [email protected]:shashankmehta/greyshade.git .themes/greyshade
$ echo "\$greyshade: color;" >> sass/custom/_colors.scss //Substitue 'color' with your highlight color
$ rake "install[greyshade]"
$ rake generate

然后,部署到github:

rake generate
git add .
git commit -am "install greyshade." 
git push origin source
rake deploy

详细内容请参考:greyshade

3、添加多说

  • 获取short_name

多说网 注册账号,并获取站点的short_name

  • 在_config.yml文件中添加如下内容
# duoshuo comments
duoshuo_comments: true
duoshuo_short_name: yourname
  • 在source/_layouts/post.html中添加多说评论模块
{% if site.duoshuo_short_name and site.duoshuo_comments == true and page.comments == true %}
  <section>
    <h1>Comments</h1>
    <div id="comments" aria-live="polite">{% include post/duoshuo.html %}</div>
  </section>
{% endif %}
  • 创建source/_includes/post/duoshuo.html,并填入如下内容
<!-- Duoshuo Comment BEGIN -->
<div class="ds-thread"></div>
<script type="text/javascript">
  var duoshuoQuery = {short_name:""};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = 'http://static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
    || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script>
<!-- Duoshuo Comment END -->
  • 发布到站点
$ rake generate
$ git add .
$ git commit -am "添加多说评论" 
$ git push origin source
$ rake deploy

4、添加百度和Google统计

从百度统计获取脚本,然后添加到文件source/_includes/after_footer.html文件中 从google analytics获取跟踪ID,然后将这个ID添加到_config.yml文件的google_analytics_tracking_id后面即可。

# Google Analytics
google_analytics_tracking_id: UA-457s202x-x

持续更新

最近的文章

Hadoop集群环境搭建及配置

1.环境准备 三台服务器:CentOS6.5系统,IP地址如下,分别配置hosts:vi /etc/hosts10.2.15.12 master #NameNode JobTracker10.2.15.13 slave1 #DataNode TaskTracker10.2.15.14 slave2 #DataNode TaskTracker JDK安装及Java环境配置下载 jdk1.7.0_51tar zxvf -C /apps/ # 解压到/apps/目录cho...…

继续阅读
更早的文章

使用Octopress搭建博客

1、安装 Git.Mac系统默认已安装Git.在终端输入git –version,应该可以看到电脑中的git版本2、安装 RubyOctopress需要Ruby环境,RVM(Ruby Version Manager)负责安装和管理Ruby的环境。我们先在Terminal中输入如下命令,来安装RVM:curl -L https://get.rvm.io | bash -s stable —ruby接着安装Ruby 1.9.3,在终端依次运行如下命令:rvm install 1.9.3rvm ...…

继续阅读