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

feat(comment): add gitment #454

Merged
merged 1 commit into from
Jul 28, 2017
Merged
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
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>