Skip to content

Commit b501ce3

Browse files
committed
删除多说评论代码,添加GitTalk评论插件
1 parent 86589de commit b501ce3

4 files changed

Lines changed: 77 additions & 167 deletions

File tree

‎_config.yml‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ anchorjs: true # if you want to customize anchor. check
3939

4040
# Gems
4141
# from PR#40, to support local preview for Jekyll 3.0
42-
gems: [jekyll-paginate]
42+
gems: [jekyll-paginate,jekyll-sitemap]
43+
4344

4445

4546

@@ -55,14 +56,17 @@ kramdown:
5556

5657

5758
# 评论系统
58-
# Disqus settings(https://disqus.com/)
59-
disqus_username: qiubaiying
60-
61-
# 多说 将于2017年6月1日正式关停服务,建议使用 Disqus(http://dev.duoshuo.com/threads/58d1169ae293b89a20c57241)
62-
# Duoshuo settings
63-
# duoshuo_username: qiubaiying
64-
# Share component is depend on Comment so we can NOT use share only.
65-
# duoshuo_share: true # set to false if you want to use Comment without Sharing
59+
# Disqus(https://disqus.com/)
60+
# disqus_username: qiubaiying
61+
62+
# Gitalk
63+
gitalk:
64+
enable: true #是否开启Gitalk评论
65+
clientID: 'f2c84e7629bb1446c1a4' #生成的clientID
66+
clientSecret: '33cdc622139d68dc2273b818d849a348d7ac7ac8' #同上
67+
repo: qiubaiying.github.io #仓库名称
68+
owner: qiubaiying #github用户名
69+
admin: qiubaiying
6670

6771

6872

‎_layouts/keynote.html‎

Lines changed: 22 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,6 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
6868

6969
<hr style="visibility: hidden;">
7070

71-
{% if site.duoshuo_share && site.duoshuo_username %}
72-
<!-- 多说 Share start -->
73-
<div class="ds-share"
74-
style="text-align: right"
75-
data-thread-key="{{page.id}}" data-title="{{page.title}}"
76-
data-images="{{ site.url }}{{site.baseurl}}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}"
77-
data-content="{{ content | strip_html | truncate:80 }} | Hux Blog,@Hux黄玄 的个人博客"
78-
data-url="{{site.url}}{{site.baseurl}}{{page.url}}">
79-
<div class="ds-share-inline">
80-
<style>
81-
.ds-share-icons-16 {display:none;}
82-
</style>
83-
<ul class="ds-share-icons-16">
84-
<li data-toggle="ds-share-icons-more"><a class="ds-more" href="#">分享到:</a></li>
85-
<li><a class="ds-wechat flat" href="javascript:void(0);" data-service="wechat">微信</a></li>
86-
<li><a class="ds-weibo flat" href="javascript:void(0);" data-service="weibo">微博</a></li>
87-
<li><a class="ds-douban flat" href="javascript:void(0);" data-service="douban">豆瓣</a></li>
88-
</ul>
89-
<div class="ds-share-icons-more">
90-
</div>
91-
</div>
92-
<hr>
93-
</div>
94-
<!-- 多少 Share end-->
95-
{% endif %}
96-
9771

9872
<ul class="pager">
9973
{% if page.previous.url %}
@@ -114,20 +88,28 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
11488
{% endif %}
11589
</ul>
11690

117-
118-
{% if site.duoshuo_username %}
119-
<!-- 多说评论框 start -->
120-
<div class="comment">
121-
<div class="ds-thread"
122-
data-thread-key="{{page.id}}"
123-
data-title="{{page.title}}"
124-
data-url="{{site.url}}{{site.baseurl}}{{page.url}}" >
125-
</div>
126-
</div>
127-
<!-- 多说评论框 end -->
91+
<!-- Gitalk 评论 start -->
92+
{% if site.gitalk.enable %}
93+
<!-- Gitalk link -->
94+
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
95+
<script src="https://unpkg.com/gitalk@latest/dist/gitalk.min.js"></script>
96+
97+
<div id="gitalk-container"></div>
98+
<script type="text/javascript">
99+
var gitalk = new Gitalk({
100+
clientID: '{{site.gitalk.clientID}}',
101+
clientSecret: '{{site.gitalk.clientSecret}}',
102+
repo: '{{site.gitalk.repo}}',
103+
owner: '{{site.gitalk.owner}}',
104+
admin: ['{{site.gitalk.admin}}'],
105+
id: window.location.pathname,
106+
});
107+
gitalk.render('gitalk-container');
108+
</script>
128109
{% endif %}
110+
<!-- Gitalk end -->
129111

130-
{% if site.disqus_username %}
112+
{% if site.disqus.enable %}
131113
<!-- disqus 评论框 start -->
132114
<div class="comment">
133115
<div id="disqus_thread" class="disqus-thread">
@@ -199,32 +181,13 @@ <h5>FRIENDS</h5>
199181
resize();
200182
</script>
201183

202-
{% if site.duoshuo_username %}
203-
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
204-
<script type="text/javascript">
205-
// dynamic User by Hux
206-
var _user = '{{site.duoshuo_username}}';
207-
208-
// duoshuo comment query.
209-
var duoshuoQuery = {short_name: _user };
210-
(function() {
211-
var ds = document.createElement('script');
212-
ds.type = 'text/javascript';ds.async = true;
213-
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
214-
ds.charset = 'UTF-8';
215-
(document.getElementsByTagName('head')[0]
216-
|| document.getElementsByTagName('body')[0]).appendChild(ds);
217-
})();
218-
</script>
219-
<!-- 多说公共JS代码 end -->
220-
{% endif %}
221184

222185

223-
{% if site.disqus_username %}
186+
{% if site.disqus.enable %}
224187
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
225188
<script type="text/javascript">
226189
/* * * CONFIGURATION VARIABLES * * */
227-
var disqus_shortname = "{{site.disqus_username}}";
190+
var disqus_shortname = "{{site.disqus.username}}";
228191
var disqus_identifier = "{{page.id}}";
229192
var disqus_url = "{{site.url}}{{page.url}}";
230193

‎_layouts/post.html‎

Lines changed: 19 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,6 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
6262

6363
<hr style="visibility: hidden;">
6464

65-
{% if site.duoshuo_share && site.duoshuo_username %}
66-
<!-- 多说 Share start -->
67-
<div class="ds-share"
68-
style="text-align: right"
69-
data-thread-key="{{page.id}}"
70-
data-title="{{page.title}}"
71-
data-url="{{site.url}}{{site.baseurl}}{{page.url}}"
72-
data-images="{{ site.url }}{{site.baseurl}}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}"
73-
data-content="{{ content | strip_html | truncate:80 }} | {{ site.SEOTitle }} " >
74-
<div class="ds-share-inline">
75-
<style>
76-
.ds-share-icons-16 {display:none;}
77-
</style>
78-
<ul class="ds-share-icons-16">
79-
<li data-toggle="ds-share-icons-more"><a class="ds-more" href="#">分享到:</a></li>
80-
<li><a class="ds-wechat flat" href="javascript:void(0);" data-service="wechat">微信</a></li>
81-
<li><a class="ds-weibo flat" href="javascript:void(0);" data-service="weibo">微博</a></li>
82-
<li><a class="ds-douban flat" href="javascript:void(0);" data-service="douban">豆瓣</a></li>
83-
</ul>
84-
<div class="ds-share-icons-more">
85-
</div>
86-
</div>
87-
<hr>
88-
</div>
89-
<!-- 多说 Share end-->
90-
{% endif %}
91-
92-
9365
<ul class="pager">
9466
{% if page.previous.url %}
9567
<li class="previous">
@@ -110,17 +82,25 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
11082
</ul>
11183

11284

113-
{% if site.duoshuo_username %}
114-
<!-- 多说评论框 start -->
115-
<div class="comment">
116-
<div class="ds-thread"
117-
data-thread-key="{{page.id}}"
118-
data-title="{{page.title}}"
119-
data-url="{{site.url}}{{site.baseurl}}{{page.url}}" >
120-
</div>
121-
</div>
122-
<!-- 多说评论框 end -->
123-
{% endif %}
85+
<!--Gitalk评论start -->
86+
{% if site.gitalk.enable %}
87+
<!-- 引入Gitalk评论插件 -->
88+
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
89+
<script src="https://unpkg.com/gitalk@latest/dist/gitalk.min.js"></script>
90+
<div id="gitalk-container"></div>
91+
<script type="text/javascript">
92+
var gitalk = new Gitalk({
93+
clientID: '{{site.gitalk.clientID}}',
94+
clientSecret: '{{site.gitalk.clientSecret}}',
95+
repo: '{{site.gitalk.repo}}',
96+
owner: '{{site.gitalk.owner}}',
97+
admin: ['{{site.gitalk.admin}}'],
98+
id: '',
99+
});
100+
gitalk.render('gitalk-container');
101+
</script>
102+
{% endif %}
103+
<!-- Gitalk end -->
124104

125105
{% if site.disqus_username %}
126106
<!-- disqus 评论框 start -->
@@ -188,27 +168,6 @@ <h5>FRIENDS</h5>
188168
</article>
189169

190170

191-
{% if site.duoshuo_username %}
192-
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
193-
<script type="text/javascript">
194-
// dynamic User by Hux
195-
var _user = '{{site.duoshuo_username}}';
196-
197-
// duoshuo comment query.
198-
var duoshuoQuery = {short_name: _user };
199-
(function() {
200-
var ds = document.createElement('script');
201-
ds.type = 'text/javascript';ds.async = true;
202-
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
203-
ds.charset = 'UTF-8';
204-
(document.getElementsByTagName('head')[0]
205-
|| document.getElementsByTagName('body')[0]).appendChild(ds);
206-
})();
207-
</script>
208-
<!-- 多说公共JS代码 end -->
209-
{% endif %}
210-
211-
212171
{% if site.disqus_username %}
213172
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
214173
<script type="text/javascript">

‎about.html‎

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -97,58 +97,41 @@ <h5>Talks</h5>
9797
</script>
9898

9999

100-
101-
{% if site.duoshuo_username %}
102-
<!-- 多说评论框 start -->
103-
<div class="comment">
104-
<!-- This id is used for indexing my loss comments forcedly -->
105-
<div class="ds-thread"
106-
{% if site.duoshuo_username == "qiubaiying" %}
107-
data-thread-id="0ee040117ec56f17aa7e2523d1eae19b"
108-
{% else %}
109-
<!-- U can just use this key generated to index comments at page about -->
110-
data-thread-key="{{site.duoshuo_username}}/about"
111-
{% endif %}
112-
113-
data-title="{{page.title}}"
114-
data-url="{{site.url}}/about/"></div>
115-
</div>
116-
<!-- 多说评论框 end -->
117-
118-
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
119-
<script type="text/javascript">
120-
// dynamic User hacking by Hux
121-
var _user = '{{site.duoshuo_username}}';
122-
123-
// duoshuo comment query.
124-
var duoshuoQuery = {short_name: _user };
125-
(function() {
126-
var ds = document.createElement('script');
127-
ds.type = 'text/javascript';ds.async = true;
128-
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
129-
ds.charset = 'UTF-8';
130-
(document.getElementsByTagName('head')[0]
131-
|| document.getElementsByTagName('body')[0]).appendChild(ds);
132-
})();
100+
<!-- Gitalk 评论 start -->
101+
{% if site.gitalk.enable %}
102+
<!-- Gitalk link -->
103+
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
104+
<script src="https://unpkg.com/gitalk@latest/dist/gitalk.min.js"></script>
105+
106+
<div id="gitalk-container"></div>
107+
<script type="text/javascript">
108+
var gitalk = new Gitalk({
109+
clientID: '{{site.gitalk.clientID}}',
110+
clientSecret: '{{site.gitalk.clientSecret}}',
111+
repo: '{{site.gitalk.repo}}',
112+
owner: '{{site.gitalk.owner}}',
113+
admin: ['{{site.gitalk.admin}}'],
114+
id: window.location.pathname,
115+
});
116+
gitalk.render('gitalk-container');
133117
</script>
134-
<!-- 多说公共JS代码 end -->
135118
{% endif %}
119+
<!-- Gitalk end -->
136120

121+
<!-- disqus 评论框 start -->
122+
{% if site.disqus.enable %}
137123

138-
{% if site.disqus_username %}
139-
<!-- disqus 评论框 start -->
140124
<div class="comment">
141125
<div id="disqus_thread" class="disqus-thread">
142-
143126
</div>
144127
</div>
145128
<!-- disqus 评论框 end -->
146129

147130
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
148131
<script type="text/javascript">
149132
/* * * CONFIGURATION VARIABLES * * */
150-
var disqus_shortname = "{{site.disqus_username}}";
151-
var disqus_identifier = "{{site.disqus_username}}/{{page.url}}";
133+
var disqus_shortname = "{{site.disqus.username}}";
134+
var disqus_identifier = "{{site.disqus.username}}/{{page.url}}";
152135
var disqus_url = "{{site.url}}{{page.url}}";
153136

154137
(function() {
@@ -159,3 +142,4 @@ <h5>Talks</h5>
159142
</script>
160143
<!-- disqus 公共JS代码 end -->
161144
{% endif %}
145+

0 commit comments

Comments
 (0)