預設主題 landscape
檔案目錄,comments為建立的
_config.yml
layout-- _partial --article.ejs|- comments --disqus.ejs|-duoshuo.ejs|- youyan.ejs
注冊評論系統:
Disqus 注冊 設定Shortname
多說 不用注冊直接登入(例如用百度賬号),設定域名
友言 注冊,檢視ID
1 修改主題配置檔案 landscape/_config.yml 添加以下内容:
# >>> Conments 評論系統 <<
# 選一個作為網站評論系統,其他保持禁用。
disqus:
on:trueshortname: yourshortname
# https://help.disqus.com/customer/en/portal/articles/466208-what-s-a-shortname-
# It is unnecessary to enable disqus here if# you have set"disqus_shortname" in your site's "_config.yml"
duoshuo:
#on:truedomain: yourdomain
# 是否開啟多說評論,http://duoshuo.com/create-site/
# 使用上面網址登陸你的多說,然後建立站點,在 domain 中填入你設定的域名
# http://你的多說域名.duoshuo.com
youyan:
#on:true
id: yourID
# 是否開啟友言評論,http://www.uyan.cc/index.php
# id中填寫你的友言使用者數字ID,注冊後進入背景管理即可檢視
# 友言服務在 Web 環境下運作,普通本地環境無法檢視,請部署後線上上測試。
#>>> <<<
2 修改 article.ejs 添加:
key: post.path,
title: post.title,
url: config.url+url_for(post.path),
})%>
shortname: theme.disqus.shortname
})%>
shortname: config.disqus_shortname
})%>
3 在comments目錄下建立3個檔案:disqus.ejs、duoshuo.ejs、youyuan.ejs
# disqus.ejs
var disqus_shortname= ''; //required: replace example with your forum shortname
(function() {
var dsq= document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src= '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.
# duoshuo.ejs
(function() {
var ds= document.createElement('script');
ds.type= 'text/javascript';ds.async = true;
ds.src= (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset= 'UTF-8';
(document.getElementsByTagName('head')[0]|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
# youyuan.ejs
配置完成,可以自由選擇使用一種評論系統了!效果如下:
對于maupassant主題,已經自帶了disqus、多說 評論系統,隻需要在maupassant/_config.yml中開啟即可