ghost 加入 disqus comment 2017

Ghost 及 disqus 官方資料不知道為什麼,完全不可考,安裝方式如下,

修改檔案位置, content/themes/casper/post.hbs

將下面的程式碼安插在,<section class="share"></section> 中間

直接選擇安裝 disqus Universal Code

<div id="disqus_thread"></div>  
<script>  
/*
var disqus_config = function () {  
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable  
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable  
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');

s.src = '//disqus-shortname.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());  
(d.head || d.body).appendChild(s);
})();
</script>  

將兩段進行修改,記得要用單引號或者雙引號包裝起來,

this.page.url = '{{url absolute="true"}}'  
this.page.identifier = 'ghost-{{id}}';  

接著再修改,

s.src = '//EXAMPLE.disqus.com/embed.js';  
// 將 example 改掉,改成 disqus organization id.

修改完成後,再重新啟動 ghost 就完整整個安裝程序了。

可以參考文章如下,

CaesarChi

Web developer, focus on website fullstack, special JavaScript, and love sharing developing experience and communicate with developers. http://about.me/clonn