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 gitalk #554

Merged
merged 2 commits into from
Oct 16, 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
8 changes: 6 additions & 2 deletions _config.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ sidebar:

# Comment Systems
# Available value of "use":
# disqus | disqus_click | changyan | livere | gitment | valine
# If you want to use gitment,you should get the client_id and client_secret form https://github.com/settings/applications/new
# disqus | disqus_click | changyan | livere | gitment | gitalk | valine
# If you want to use gitment or gitalk,you should get the client_id and client_secret form https://github.com/settings/applications/new
# If you want to use valine,you should get the app_id and app_key form https://leancloud.cn ,more setting please see https://github.com/xCss/Valine
comment:
use:
Expand All @@ -237,6 +237,10 @@ comment:
gitment_client_secret : # github app client secret
valine_leancloud_appId: # leancloud application app id
valine_leancloud_appKey: # leancloud application app key
gitalk_owner: # git repo of the hexo
gitalk_repo: # git repo's owner
gitalk_client_id: # github app client id
gitalk_client_secret : # github app client secret

# Search Systems
# Available value:
Expand Down
1 change: 1 addition & 0 deletions layout/_widget/comment/gitalk/common.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- GitTalk -->
10 changes: 10 additions & 0 deletions layout/_widget/comment/gitalk/enter.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- 使用 Gitalk -->
<div id="gitalk-comment">
<%- partial('_widget/comment/' + theme.comment.use + '/main') %>
</div>
<style>
#gitalk-comment {
background-color: #eee;
padding: 2pc;
}
</style>
19 changes: 19 additions & 0 deletions layout/_widget/comment/gitalk/main.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Gitalk 评论框 -->
<div id="gitalk-container"></div>

<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">

<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

<script>
var gitalk = new Gitalk({
clientID: '<%= theme.comment.gitalk_client_id %>',
clientSecret: '<%= theme.comment.gitalk_client_secret %>',
repo: '<%= theme.comment.gitalk_repo %>',
owner: '<%= theme.comment.gitalk_owner %>',
admin: ['<%= theme.comment.gitalk_owner %>'],
// facebook-like distraction free mode
distractionFreeMode: false
})
gitalk.render('gitalk-container')
</script>