Skip to content

Commit

Permalink
多说要关闭了,修改为使用搜狐畅言评论插件
Browse files Browse the repository at this point in the history
  • Loading branch information
Clarence-pan committed Mar 22, 2017
1 parent 96b9a6a commit a6a85f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 8 additions & 2 deletions themes/indigo/_config.yml
Expand Up @@ -99,9 +99,15 @@ less:
- source/css/style.less

# 是否开启多说评论,填写你在多说创建的站点二级域名
duoshuo: clarence-pan
duoshuo: false
# 是否开启多说评论计数(该服务不稳定)
duoshuo_count: true
duoshuo_count: false

# 搜狐畅言的appid配置: (如果为false,则不显示搜狐畅言)
changyan: cysUkeX5G
# 搜狐畅言的conf配置:
changyan_conf: prod_60afcdd5c73414aea0e0dce2601a3563

# 使用 disqus 时关闭多说评论
disqus_shortname: false

Expand Down
10 changes: 10 additions & 0 deletions themes/indigo/layout/_partial/plugins/changyan.ejs
@@ -0,0 +1,10 @@
<% if (theme.changyan){ %>
<div id="SOHUCS" sid="<%- sid %>" ></div>
<script type="text/javascript">
(function(){
var appid = '<%- theme.changyan %>';
var conf = '<%- theme.changyan_conf %>';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width<960){window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })();
</script>
<% } %>
2 changes: 2 additions & 0 deletions themes/indigo/layout/_partial/post/comment.ejs
Expand Up @@ -4,6 +4,8 @@
title: post.title,
url: url
}) %>
<%- partial('../plugins/changyan', {sid: post.slug}) %>
<%- partial('../plugins/disqus') %>
<%} %>

5 comments on commit a6a85f8

@Wensibob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以支持除了畅言之外的评论系统吗?

@Clarence-pan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他评论系统没有试过,你可以试试。应该都差不多,无外乎就这三个文件修改下。

@yunxu-it
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不错,效仿着安上了网易云跟帖

@jasonzhang1986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

网易云跟帖搞了半天,没搞定,可以共享下方法吗? @yunxu-it

@jasonzhang1986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yunxu-it 看到你的博客记载了,已经成功接入,多谢!!

Please sign in to comment.