Skip to content

Commit 1cb81c6

Browse files
更新评论系统
1 parent 14a1953 commit 1cb81c6

4 files changed

Lines changed: 37 additions & 30 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ CodeboyBlog
4646
4747
## 需要配置的内容:
4848
49-
1. 修改_config.yml中的信息(知乎等帐号,特别需要注意的是网易云跟贴(cloud_tie_public_key)必须更换,否则您将不能查看到博客的评论)。
49+
1. 修改_config.yml中的信息(知乎等帐号,特别需要注意的是畅言配置(changyan_appid和changyan_appid)必须更换,否则您将不能查看到博客的评论)。 畅言的申请地址 [http://changyan.kuaizhan.com/](http://changyan.kuaizhan.com/)
5050
2. 修改about/index.html中个人信息(如果不需要个人简介,可以在步骤3中去除对应标签)。
5151
3. 修改_include/nav.html,选择自己需要的导航标签(主页, 应用, 标签, 关于等)
5252
4. 如果博客底部的github,知乎等需要修改,请编辑_includes/footer.html中分享的信息。
5353
5. 去除CNAME文件,或者CNAME文件中的域名更换为您的博客域名。
5454
5555
## 更新内容:
5656
57+
#### 2018-05-03
58+
59+
- 评论组件调整为畅言。
60+
5761
#### 2017-12-19
5862
5963
- 代码显示行号。(/css/syntax.css)

_config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ url: "http://127.0.0.1"
77
description: "编码生涯的点点滴滴"
88
github_username: androiddevelop
99
zhihu_username: codeboy
10-
cloud_tie_public_key: "\"7a06774f1f184badbb64d9af7c3d5c2c\""
11-
##########################上述信息需要您修改,cloud_tie_public_key两侧必须有引号############################
10+
11+
#changyan_appid: "\"changyan_appid"\"
12+
#changyan_conf: "\"changyan_conf"\"
13+
##########################上述信息需要您修改,changyan_appid、changyan_conf############################
1214

1315

1416
# Where things are

_includes/footer.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,17 @@
101101
<script src="{{ "/search/js/cb-search.js" | prepend: site.baseurl }}"></script>
102102

103103
<script>
104-
//代码高亮自定义
105-
$("code").each(function(){
106-
var content = $(this).html().replace(/\n/g,"\n</li><li>");
107-
if(content.indexOf('<li>') == -1){
108-
//适配`abc`,放行
109-
}else{
110-
$(this).html("<ul><li>" + content.substring(0, content.length - 4) +"</ul>"); //适配```
111-
}
112-
});
104+
$(document).ready(function(){
105+
//代码高亮自定义
106+
$("code").each(function(){
107+
var content = $(this).html().replace(/\n/g,"\n</li><li>");
108+
if(content.indexOf('<li>') == -1){
109+
//适配`abc`,放行
110+
}else{
111+
$(this).html("<ul><li>" + content.substring(0, content.length - 4) +"</ul>"); //适配```
112+
}
113+
});
114+
})
113115
</script>
114116

115117
<div style="display:none;">

_layouts/post.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,25 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
2929

3030
<!-- Post Content -->
3131
<article>
32-
<div class="container" style="overflow-y:hidden;">
33-
<div class="row">
34-
<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 post-container">
32+
<div class="container" style="overflow-y:hidden;">
33+
<div class="row">
34+
<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 post-container">
3535

3636
{{ content }}
3737

38-
<hr>
39-
40-
<!-- 网易评论框 start -->
41-
<div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
42-
<script>
43-
var cloudTieConfig = {
44-
url: document.location.href,
45-
sourceId: "",
46-
productKey: {{site.cloud_tie_public_key}},
47-
target: "cloud-tie-wrapper"
48-
};
49-
</script>
50-
<script src="https://img1.cache.netease.com/f2e/tie/yun/sdk/loader.js"></script>
51-
<!-- 网易评论框 end -->
52-
</div>
38+
<hr>
39+
</div>
40+
41+
<!-- 畅言评论框 start-->
42+
<div id="SOHUCS" ></div>
43+
<script type="text/javascript">
44+
(function(){
45+
var appid = {{site.changyan_appid}};
46+
var conf = {{site.changyan_conf}};
47+
var width = window.innerWidth || document.documentElement.clientWidth;
48+
if (width < 960) {
49+
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>
50+
<!-- 畅言评论框 end -->
5351
</div>
52+
</div>
5453
</article>

0 commit comments

Comments
 (0)