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

gitment #232

Open
wants to merge 2 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ show_count: false
## 是否在主页文章标题旁显示评论数(多说、Disqus)
## Add comment count after article title



gitment:
#on: true
gitment_GitHub_id: your github username
gitment_repo: your github repo
gitment_client_id: XXXXX
gitment_client_secret: XXXXXXXX
# use gitment issue
# this comments only use github ,and push github 'gitment_repo'
# if use gitment this the four params should have content.
# you can get gitment_client_id and gitment_client_secret through https://github.com/settings/applications/new
#

disqus:
#on: true
shortname:
Expand Down
9 changes: 8 additions & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@
<% } %>

<% if (!index && post.comments){ %>
<% if (theme.duoshuo.on) { %>

<% if (theme.gitment.on) { %>
<%- partial('comments/gitment', {
key: post.path,
title: post.title,
url: config.url+url_for(post.path),
}) %>
<% } else if (theme.duoshuo.on) { %>
<%- partial('comments/duoshuo', {
key: post.path,
title: post.title,
Expand Down
17 changes: 17 additions & 0 deletions layout/_partial/comments/gitment.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<section class="gitment" id="comments">
<div id="gitment" class ="article article-type-post"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: '<%=title%>',
owner: '<%= theme.gitment.gitment_GitHub_id%>',
repo: '<%= theme.gitment.gitment_repo%>',
oauth: {
client_id: '<%= theme.gitment.gitment_client_id%>',
client_secret: '<%= theme.gitment.gitment_client_secret%>',
},
})
gitment.render('gitment')
</script>
</section>