Permalink
Browse files

refactor: comments code & configuration 评论模块优化

Rewrite comment setting, make it clearer.
代码逻辑优化,重写注释,减少误解。
  • Loading branch information...
MOxFIVE committed Jan 1, 2016
1 parent 021c7ba commit 3138ca36bd209fd9f79b60fbb6b15b44673560b5
View
@@ -135,10 +135,11 @@ Disable fancybox in certain post/page | 在某篇文章中关闭 fancybox:
> Add `fancybox: false` in [front-matter](https://hexo.io/docs/front-matter.html)
#### 5. Comment 多说评论:
在 `themes/yelee/_config.yml` 中,按 `duoshuo: duoshuo-key` 填写。
#### 5. Comment 评论:
Disqus, duoshuo and youyan is supported, enable them in theme's "_config.yml".
主题目测支持 Disqus,多说 和友言评论,自行在主题配置中开启。
注册多说后,地址前面的就是你的 duoshuo-key http://duoshuo-key.duoshuo.com
多说: http://duoshuo.com/create-site/ 登陆你的多说并创建站点,在 "domain" 中填入你设定的域名。请设置好自己专属的多说,不要再群聊了。
> - [保留使用 Yilia 主题时的多说用户评论](https://github.com/MOxFIVE/hexo-theme-yelee/issues/1)
View
@@ -57,20 +57,32 @@ avatar: /img/avatar.png
#是否开启分享
share: true
#若使用disqus,请在博客config文件中填写disqus_shortname,并关闭多说评论
#是否开启多说评论,填写你在多说申请的项目名称 duoshuo: duoshuo-key
#注册多说后,地址前面的就是你的 duoshuo-key http://duoshuo-key.duoshuo.com
#duoshuo:
#若使用disqus,请在博客config文件中填写disqus_shortname,并关闭友言评论和多说评论
#是否开启友言评论,设置on为true并填写友言id(注册后进入后台管理即可看到)
#友言官网: http://www.uyan.cc/index.php
#这里使用的是通用代码
#由于友言的所有服务是在WEB环境下运行,所以必须在线上测试。
#除非有构建虚拟运行环境和虚拟域名,在前台才能显示(可以使用nginx或者花生壳内网映射调试)。
# >>> Conments 评论系统 <<<
# Chose ONE as your comment system and keep others disable.
# 选一个作为网站评论系统,其他保持禁用。
disqus:
#on: true
shortname:
# 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: true
domain:
# 是否开启多说评论,http://duoshuo.com/create-site/
# 使用上面网址登陆你的多说,然后创建站点,在 domain 中填入你设定的域名
# http://你的多说域名.duoshuo.com
youyan:
on: false
id: 'your id'
#on: true
id:
# 是否开启友言评论,http://www.uyan.cc/index.php
# id 中填写你的友言用户数字ID,注册后进入后台管理即可查看
# 友言服务在 Web 环境下运行,普通本地环境无法查看,请部署后在线上测试。
# >>> <<<
#是否开启云标签
tagcloud: true
@@ -96,8 +108,8 @@ aboutme: 专注于前端
#Site Verification for Google and Baidu. HTML label content.
#百度、谷歌站长验证。填写 HTML 标签 content
#baidu_site:
#google_site:
baidu_site:
google_site:
#Keep TOC title on the same line.
#目录中标题不换行
@@ -63,34 +63,24 @@
<%- partial('post/share') %>
<% } %>
<% if (!index && theme.duoshuo && post.comments){ %>
<%- partial('post/duoshuo', {
key: post.path,
title: post.title,
url: config.url+url_for(post.path),
}) %>
<% } %>
<% if (!index && theme.youyan && theme.youyan.on && post.comments) { %>
<%- partial('post/youyan') %>
<% } %>
<% if (!index && post.comments && config.disqus_shortname){ %>
<section id="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '<%=config.disqus_shortname%>'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(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);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</section>
<% if (!index && post.comments){ %>
<% if (theme.duoshuo.on) { %>
<%- partial('comments/duoshuo', {
key: post.path,
title: post.title,
url: config.url+url_for(post.path),
}) %>
<% } else if (theme.youyan.on) { %>
<%- partial('comments/youyan') %>
<% } else if (theme.disqus.on) { %>
<%- partial('comments/disqus', {
shortname: theme.disqus.shortname
}) %>
<% } else if (config.disqus_shortname) { %>
<%- partial('comments/disqus', {
shortname: config.disqus_shortname
}) %>
<% } %>
<% } %>
<%- partial('_partial/post-nav-button') %>
@@ -0,0 +1,15 @@
<section id="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '<%= shortname%>'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(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);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</section>
@@ -4,7 +4,7 @@
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"<%=theme.duoshuo%>"};
var duoshuoQuery = {short_name:"<%=theme.duoshuo.domain%>"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;

0 comments on commit 3138ca3

Please sign in to comment.