博客怎么能少了評(píng)論呢?雖然 Octopress 自帶了 disqus 評(píng)論系統(tǒng),但是登錄需要使用推特,臉書,Google+等帳號(hào)登錄,因大多人都沒有這些賬戶,所以使用國(guó)內(nèi)的多說評(píng)論系統(tǒng),非軟文,可以用國(guó)內(nèi)大部分主流帳號(hào)登錄評(píng)論即可。
進(jìn)入http://duoshuo.com/create-site,登錄帳號(hào),填寫相關(guān)信息,點(diǎn)擊創(chuàng)建。這里的多說域名就是你的多說后臺(tái),可以在這里管理你的評(píng)論。 這里我獲取的代碼是,自行修改 short_name。
<!-- Duoshuo Comment BEGIN -->
<div class="ds-thread"></div>
<script type="text/javascript">
var duoshuoQuery = {short_name:"jackystuio"};
(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 -->
進(jìn)入 Octopress\source_includes\post,創(chuàng)建名為 duoshuo.html 的文件,把上面的代碼拷入。
進(jìn)入 Octopress\source_layouts,打開 post.html,在 disqus 布局后面加入多說的布局。
{% if site.duoshuo and page.comments == true %}
<section>
<h1>Comments</h1>
<div id="comments" aria-live="polite">{% include post/duoshuo.html %}</div>
</section>
{% endif %}
進(jìn)入 Octopress 目錄,打開_config.yml
,在末尾添加如下代碼,如果想關(guān)閉多說評(píng)論,把 true 改為 false 即可。
# duoshuo comments
duoshuo: true
完成以上步驟后,執(zhí)行
rake generate
rake preview
rake deploy
查看文章頁面http://geekjacky.github.io/blog/2013/11/13/hello-github-blog/
http://wiki.jikexueyuan.com/project/github-page/images/helloblog1.jpg" alt="" />
git add .
git commit -m "添加多說評(píng)論"
git push origin source