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

Add gitment #219

Merged
merged 2 commits into from
May 5, 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: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ disqus_shortname: false
uyan_uid: false
# 是否开启网易云跟帖, 填写app sdk中的app key
wangyi_ygt: false
# 关闭
# gitment: false
# 开启
gitment:
owner:
repo:
client_id:
client_secret:

# 规范网址
# 让搜索引擎重定向你的不同域名、不同子域、同域不同目录的站点到你期望的路径
Expand Down
18 changes: 18 additions & 0 deletions layout/_partial/plugins/gitment.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% if (theme.gitment){ %>
<section class="comments" id="comments">
<div id="gitment_thread"></div>
<link rel="stylesheet" href="//unpkg.com/gitment/style/default.css">
<script src="//unpkg.com/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
owner: '<%- theme.gitment.owner %>',
repo: '<%- theme.gitment.repo %>',
oauth: {
client_id: '<%- theme.gitment.client_id %>',
client_secret: '<%- theme.gitment.client_secret %>',
},
})
gitment.render('comments')
</script>
</section>
<% } %>
2 changes: 2 additions & 0 deletions layout/_partial/post/comment.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
key: post.slug,
url: url
}) %>

<%- partial('../plugins/gitment') %>
<%} %>