Skip to content

Commit 341b4d5

Browse files
authored
Merge pull request #1155 from ivan-nginx/5.1.0
Add Hypercomments system.
2 parents 27e0a7a + 04f4941 commit 341b4d5

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

_config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ mathjax:
244244
# Disqus
245245
#disqus_shortname:
246246

247+
# Hypercomments
248+
#hypercomments_id:
249+
247250
# Baidu Share
248251
# Available value:
249252
# button | slide

layout/_macro/post.swig

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@
9494
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentsCount"></span>
9595
</a>
9696
</span>
97+
{% elseif theme.hypercomments_id %}
98+
<!--noindex-->
99+
<span class="post-comments-count">
100+
&nbsp;|&nbsp;
101+
<span class="post-meta-item-icon">
102+
<i class="fa fa-comment-o"></i>
103+
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
104+
<span class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentsCount"></span>
105+
</a>
106+
</span>
107+
</span>
108+
<!--/noindex-->
97109
{% endif %}
98110
{% endif %}
99111

layout/_partials/comments.swig

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a>
1212
</noscript>
1313
</div>
14+
{% elseif theme.hypercomments_id %}
15+
<div id="hypercomments_widget"></div>
1416
{% endif %}
1517
</div>
1618
{% endif %}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
{% include './comments/duoshuo.swig' %}
22
{% include './comments/disqus.swig' %}
3+
{% include './comments/hypercomments.swig' %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname %}
2+
3+
{% if theme.hypercomments_id %}
4+
5+
<script type="text/javascript">
6+
_hcwp = window._hcwp || [];
7+
8+
_hcwp.push({widget:"Bloggerstream", widget_id: {{ theme.hypercomments_id }}, selector:".hc-comment-count", label: "{\%COUNT%\}" });
9+
10+
{% if page.comments %}
11+
_hcwp.push({widget:"Stream", widget_id: {{ theme.hypercomments_id }}, xid: "{{ page.path }}"});
12+
{% endif %}
13+
14+
(function() {
15+
if("HC_LOAD_INIT" in window)return;
16+
HC_LOAD_INIT = true;
17+
var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || "en").substr(0, 2).toLowerCase();
18+
var hcc = document.createElement("script"); hcc.type = "text/javascript"; hcc.async = true;
19+
hcc.src = ("https:" == document.location.protocol ? "https" : "http")+"://w.hypercomments.com/widget/hc/{{ theme.hypercomments_id }}/"+lang+"/widget.js";
20+
var s = document.getElementsByTagName("script")[0];
21+
s.parentNode.insertBefore(hcc, s.nextSibling);
22+
})();
23+
</script>
24+
25+
{% endif %}
26+
27+
{% endif %}

0 commit comments

Comments
 (0)