Add gitment module. (#260)

pull/161/merge
Vimiix 2017-06-01 16:26:26 +08:00 committed by Ruipeng Zhang
parent e4690e79a3
commit 61d75c67b0
4 changed files with 27 additions and 0 deletions

View File

@ -58,6 +58,12 @@ comment:
changyan: # please fill in `appid` and `conf` to enable
appid:
conf:
gitment:
owner: #your github ID
repo: #the repo to store comments
#Register an OAuth application, and you will get a client ID and a client secret.
client_id: #your client ID
client_secret: #your client secret
# Share
share: default # options: jiathis, bdshare, addtoany, default

View File

@ -0,0 +1,17 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<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({
owner: '<%= theme.comment.gitment.owner %>',
repo: '<%= theme.comment.gitment.repo %>',
oauth: {
client_id: '<%= theme.comment.gitment.client_id %>',
client_secret: '<%= theme.comment.gitment.client_secret %>',
},
})
gitment.render('commentContainer')
</script>
<% } else { %>
<div id="commentContainer"></div>
<% } %>

View File

@ -12,6 +12,8 @@
<%- partial('comment/isso') %>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<%- partial('comment/changyan') %>
<% } else if (theme.comment.gitment) { %>
<%- partial('comment/gitment') %>
<% } %>
</section>
<% } %>

View File

@ -10,4 +10,6 @@
<%- partial('comment/isso', { script: true }) %>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<%- partial('comment/changyan', { script: true }) %>
<% } else if (theme.comment.gitment.owner && theme.comment.gitment.repo && theme.comment.gitment.client_id && theme.comment.gitment.client_secret) { %>
<%- partial('comment/gitment', { script: true }) %>
<% } %>