Skip to content

Commit baf44d2

Browse files
committed
merge from rpsh pull-request, add disqus
2 parents a382402 + 423c591 commit baf44d2

File tree

8 files changed

+104
-15
lines changed

8 files changed

+104
-15
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ Furthermore, if you only wanna use comment without sharing, you can set `duoshuo
223223
Disabling the whole thing is also easy, and just comment out the code.
224224

225225

226+
Another type of comment widget: [Disqus](https://disqus.com/)
227+
228+
```
229+
disqus_username: huxblog # write down your own
230+
```
231+
232+
226233
#### Analytics
227234

228235
From V1.5, we support Google Analytics and Baidu Tongji officially with a deathly simple config:

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ duoshuo_username: huxblog
4545
duoshuo_share: true # set to false if you want to use Comment without Sharing
4646

4747

48+
# Disqus settings
49+
disqus_username: hux
4850

4951

5052
# Analytics settings

_layouts/keynote.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
109109
</div>
110110
<!-- 多说评论框 end -->
111111
{% endif %}
112+
113+
{% if site.disqus_username %}
114+
<!-- disqus 评论框 start -->
115+
<div class="comment">
116+
<div id="disqus_thread" class="disqus-thread">
117+
118+
</div>
119+
</div>
120+
<!-- disqus 评论框 end -->
121+
{% endif %}
122+
112123
</div>
113124

114125
<!-- Sidebar Container -->
@@ -192,6 +203,24 @@ <h5>FRIENDS</h5>
192203
{% endif %}
193204

194205

206+
{% if site.disqus_username %}
207+
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
208+
<script type="text/javascript">
209+
/* * * CONFIGURATION VARIABLES * * */
210+
var disqus_shortname = "{{site.disqus_username}}";
211+
var disqus_identifier = "{{page.id}}";
212+
var disqus_url = "{{site.url}}{{page.url}}";
213+
214+
(function() {
215+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
216+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
217+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
218+
})();
219+
</script>
220+
<!-- disqus 公共JS代码 end -->
221+
{% endif %}
222+
223+
195224
{% if site.anchorjs %}
196225
<!-- async load function -->
197226
<script>

_layouts/post.html

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
103103
<!-- 多说评论框 end -->
104104
{% endif %}
105105

106+
{% if site.disqus_username %}
107+
<!-- disqus 评论框 start -->
108+
<div class="comment">
109+
<div id="disqus_thread" class="disqus-thread"></div>
110+
</div>
111+
<!-- disqus 评论框 end -->
112+
{% endif %}
113+
106114
</div>
107115

108116
<!-- Sidebar Container -->
@@ -143,7 +151,6 @@ <h5>FRIENDS</h5>
143151
</div>
144152
</article>
145153

146-
147154
{% if site.duoshuo_username %}
148155
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
149156
<script type="text/javascript">
@@ -165,6 +172,24 @@ <h5>FRIENDS</h5>
165172
{% endif %}
166173

167174

175+
{% if site.disqus_username %}
176+
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
177+
<script type="text/javascript">
178+
/* * * CONFIGURATION VARIABLES * * */
179+
var disqus_shortname = "{{site.disqus_username}}";
180+
var disqus_identifier = "{{page.id}}";
181+
var disqus_url = "{{site.url}}{{page.url}}";
182+
183+
(function() {
184+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
185+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
186+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
187+
})();
188+
</script>
189+
<!-- disqus 公共JS代码 end -->
190+
{% endif %}
191+
192+
168193
{% if site.anchorjs %}
169194
<!-- async load function -->
170195
<script>

about.html

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@
105105

106106
{% if site.duoshuo_username %}
107107
<!-- 多说评论框 start -->
108-
<div class="comment">
109-
<div class="ds-thread"
110-
{% if site.duoshuo_username == "huxblog" %}
111-
data-thread-id="1187623191091085319"
112-
{% else %}
113-
data-thread-key="{{site.duoshuo_username}}/about"
114-
{% endif %}
115-
116-
data-title="{{page.title}}"
117-
data-url="{{site.url}}/about/"></div>
118-
</div>
108+
<div class="comment">
109+
<div class="ds-thread"
110+
{% if site.duoshuo_username == "huxblog" %}
111+
data-thread-id="1187623191091085319"
112+
{% else %}
113+
data-thread-key="{{site.duoshuo_username}}/about"
114+
{% endif %}
115+
116+
data-title="{{page.title}}"
117+
data-url="{{site.url}}/about/"></div>
118+
</div>
119119
<!-- 多说评论框 end -->
120120

121121
<!-- Duoshuo hacking -->
@@ -138,3 +138,29 @@
138138
</script>
139139
<!-- 多说公共JS代码 end -->
140140
{% endif %}
141+
142+
143+
{% if site.disqus_username %}
144+
<!-- disqus 评论框 start -->
145+
<div class="comment">
146+
<div id="disqus_thread" class="disqus-thread">
147+
148+
</div>
149+
</div>
150+
<!-- disqus 评论框 end -->
151+
152+
<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
153+
<script type="text/javascript">
154+
/* * * CONFIGURATION VARIABLES * * */
155+
var disqus_shortname = "{{site.disqus_username}}";
156+
var disqus_identifier = "{{site.disqus_username}}/{{page.url}}";
157+
var disqus_url = "{{site.url}}{{page.url}}";
158+
159+
(function() {
160+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
161+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
162+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
163+
})();
164+
</script>
165+
<!-- disqus 公共JS代码 end -->
166+
{% endif %}

css/hux-blog.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ body {
879879
margin-top: 3px;
880880
}
881881
/* Hux customize Style for Duoshuo */
882-
.comment #ds-thread {
882+
.comment {
883883
margin-top: 20px;
884884
}
885885
.comment #ds-thread #ds-reset a.ds-like-thread-button {

css/hux-blog.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

less/hux-blog.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@ body {
880880

881881
/* Hux customize Style for Duoshuo */
882882
.comment{
883+
margin-top: 20px;
883884
#ds-thread {
884-
margin-top: 20px;
885885
#ds-reset {
886886
a.ds-like-thread-button{
887887
border:1px solid #ddd;

0 commit comments

Comments
 (0)