Skip to content

Commit

Permalink
feat: 增加gitment评论
Browse files Browse the repository at this point in the history
  • Loading branch information
litten committed Sep 4, 2017
1 parent 6fc5664 commit af58957
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 40 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ avatar:
#是否开启分享
share_jia: true
#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus 不需要使用某项,直接设置值为false,或注释掉
#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus;5、Gitment
#不需要使用某项,直接设置值为false,或注释掉
#具体请参考wiki:https://github.com/litten/hexo-theme-yilia/wiki/
#1、多说
Expand All @@ -171,6 +172,13 @@ changyan_conf: false
#4、Disqus 在hexo根目录的config里也有disqus_shortname字段,优先使用yilia的
disqus: false
#5、Gitment
gitment_owner: false #你的 GitHub ID
gitment_repo: '' #存储评论的 repo
gitment_oauth:
client_id: '' #client ID
client_secret: '' #client secret
# 样式定制 - 一般不需要修改,除非有很强的定制欲望…
style:
# 头像上面的背景颜色
Expand Down
10 changes: 9 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ avatar:
#是否开启分享
share_jia: true

#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus 不需要使用某项,直接设置值为false,或注释掉
#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus;5、Gitment
#不需要使用某项,直接设置值为false,或注释掉
#具体请参考wiki:https://github.com/litten/hexo-theme-yilia/wiki/

#1、多说
Expand All @@ -89,6 +90,13 @@ changyan_conf: false
#4、Disqus 在hexo根目录的config里也有disqus_shortname字段,优先使用yilia的
disqus: false

#5、Gitment
gitment_owner: false #你的 GitHub ID
gitment_repo: '' #存储评论的 repo
gitment_oauth:
client_id: '' #client ID
client_secret: '' #client secret

# 样式定制 - 一般不需要修改,除非有很强的定制欲望…
style:
# 头像上面的背景颜色
Expand Down
8 changes: 8 additions & 0 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,12 @@
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</section>
<% } %>

<% if (theme.gitment_owner && theme.gitment_repo &&theme.gitment_oauth && theme.gitment_oauth.client_id && theme.gitment_oauth.client_secret){ %>
<%- partial('post/gitment', {
key: post.slug,
title: post.title,
url: config.url+url_for(post.path)
}) %>
<% } %>
<% } %>
2 changes: 1 addition & 1 deletion layout/_partial/css.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<link rel="stylesheet" type="text/css" href="<%=config.root%>./main.e8862b.css">
<link rel="stylesheet" type="text/css" href="<%=config.root%>./main.507b3a.css">
15 changes: 15 additions & 0 deletions layout/_partial/post/gitment.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div id="gitment-ctn"></div>
<link rel="stylesheet" href="//imsun.github.io/gitment/style/default.css">
<script src="//imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: "<%=url%>",
owner: '<%=theme.gitment_owner%>',
repo: '<%=theme.gitment_repo%>',
oauth: {
client_id: '<%=theme.gitment_oauth.client_id%>',
client_secret: '<%=theme.gitment_oauth.client_secret%>',
},
})
gitment.render('gitment-ctn')
</script>
5 changes: 4 additions & 1 deletion layout/_partial/script.ejs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source-src/css/comment.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#disqus_thread, .duoshuo, .cloud-tie-wrapper, #SOHUCS {
#disqus_thread, .duoshuo, .cloud-tie-wrapper, #SOHUCS, #gitment-ctn {
padding: 0 30px !important;
min-height: 20px;
}
Expand Down
4 changes: 2 additions & 2 deletions source-src/css/tools.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.tools-col {
width: 360px;
width: 300px;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 998;
z-index: 0;
padding: 0;
opacity: 0;
-webkit-overflow-scrolling: touch;
Expand Down
1 change: 1 addition & 0 deletions source/main.507b3a.css

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions source/main.507b3a.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion source/main.e8862b.css

This file was deleted.

14 changes: 0 additions & 14 deletions source/main.e8862b.js

This file was deleted.

4 changes: 4 additions & 0 deletions source/mobile.992cbe.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions source/mobile.e9b30a.js

This file was deleted.

14 changes: 14 additions & 0 deletions source/slider.096dc6.js

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions source/slider.5b7e29.js

This file was deleted.

0 comments on commit af58957

Please sign in to comment.