Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introducing coding comments #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ kramdown:
# Disqus settings
disqus_username: hux

# Coding Comments Settings
coding_comments:
user:
project:
oauth:
client_id:
client_secret:

# Netease setttings
netease_comment: false

Expand Down
29 changes: 29 additions & 0 deletions _includes/coding_comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% if site.coding_comments.user %}
<!-- coding_comments 公共JS代码 start (一个网页只需插入一次) -->
<link rel="stylesheet" href="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.0.3/default.css">
<script type="text/javascript" src="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.0.3/gitment.min.js"></script>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var coding_comments_user = "{{site.coding_comments.user}}";
var coding_comments_project = "{{site.coding_comments.user}}";
var coding_comments_client_id = "{{site.coding_comments.oauth.client_id}}";
var coding_comments_client_secret = "{{site.coding_comments.oauth.client_secret}}";

var coding_comments_id = "{{site.url}}{{page.url}}";

(function() {
const gitment = new Gitment({
owner: coding_comments_user,
repo: coding_comments_project,
oauth: {
client_id: coding_comments_client_id,
client_secret: coding_comments_client_secret,
},
author: 'i@wusisu.com', // how to contact with you
theme: 'huxpro.github.io' // where to download this blog's theme
})
document.getElementById('coding_comments_thread').appendChild(gitment.render())
})();
</script>
<!-- coding_comments 公共JS代码 end -->
{% endif %}
9 changes: 9 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
<!-- disqus 评论框 end -->
{% endif %}

{% if site.coding_comments.user %}
<!-- coding_comments 评论框 start -->
<div class="comment">
<div id="coding_comments_thread" class="coding_comments-thread"></div>
</div>
<!-- coding_comments 评论框 end -->
{% endif %}

{% if site.netease_comment %}
<!-- 网易云跟帖 评论框 start -->
<div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
Expand Down Expand Up @@ -187,6 +195,7 @@ <h5>FRIENDS</h5>
<!-- disqus 公共JS代码 end -->
{% endif %}

{% include coding_comments.html %}

{% if site.anchorjs %}
<!-- async load function -->
Expand Down