Skip to content

Commit

Permalink
merge(#454): merge ElderJames/feat/comment/gitment into canary
Browse files Browse the repository at this point in the history
feat(comment): add gitment
  • Loading branch information
neoFelhz committed Jul 28, 2017
2 parents a153bd4 + 5b940fc commit 3b8d3b7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
7 changes: 6 additions & 1 deletion _config.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,19 @@ sidebar:

# Comment Systems
# Available value of "use":
# disqus | disqus_click | changyan | livere
# disqus | disqus_click | changyan | livere | gitment
# If you want to use gitment,you should get the client_id and client_secret form https://github.com/settings/applications/new
comment:
use:
shortname: # duoshuo or disqus shortname
changyan_appid:
changyan_conf:
changyan_thread_key_type: path
livere_data_uid:
gitment_repo: # git repo of the hexo
gitment_owner: # git repo's owner
gitment_client_id: # github app client id
gitment_client_secret : # github app client secret

# Search Systems
# Available value:
Expand Down
15 changes: 15 additions & 0 deletions layout/_widget/comment/gitment/common.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<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: '页面 ID', // 可选。默认为 location.href
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('container')
</script>
10 changes: 10 additions & 0 deletions layout/_widget/comment/gitment/enter.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- 使用 gitcoment -->
<div id="gitment-comment">
<%- partial('_widget/comment/' + theme.comment.use + '/main') %>
</div>
<style>
#gitment-comment{
background-color: #eee;
padding: 2pc;
}
</style>
2 changes: 2 additions & 0 deletions layout/_widget/comment/gitment/main.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- Gitment 评论框 -->
<div id="container"></div>

0 comments on commit 3b8d3b7

Please sign in to comment.