Skip to content

Commit

Permalink
add gitalk
Browse files Browse the repository at this point in the history
  • Loading branch information
j0ck1e committed Sep 13, 2018
1 parent 5cd9ba5 commit 2a9fce1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 15 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ hexo-theme-yilia

Yilia 是为 [hexo](https://github.com/tommy351/hexo) 2.4+制作的主题。
崇尚简约优雅,以及极致的性能。 你可以点击 [我的博客](http://litten.me/) 查看效果。

如果想体验手机浏览效果,可以扫一下二维码:

![litten-qrcode](https://cloud.githubusercontent.com/assets/2024949/6349328/51a067fe-bc64-11e4-881c-f68050c50c28.png)
Expand Down Expand Up @@ -34,7 +34,7 @@ Yilia 是为 [hexo](https://github.com/tommy351/hexo) 2.4+制作的主题。
**计划中:**

1. 移动端优化

## 一、外观

####**常规**
Expand Down Expand Up @@ -110,7 +110,7 @@ rss: /atom.xml
# 是否需要修改 root 路径
# 如果您的网站存放在子目录中,例如 http://yoursite.com/blog,
# 请将您的 url 设为 http://yoursite.com/blog 并把 root 设为 /blog/。
root:
root:
# Content
Expand All @@ -129,9 +129,9 @@ reward_type: 2
# 打赏wording
reward_wording: '谢谢你请我吃糖果'
# 支付宝二维码图片地址,跟你设置头像的方式一样。比如:/assets/img/alipay.jpg
alipay:
alipay:
# 微信二维码图片地址
weixin:
weixin:
# 目录
# 目录设定:0-不显示目录; 1-文章对应的md文件里有toc:true属性,才有目录; 2-所有文章均显示目录
Expand All @@ -155,7 +155,7 @@ avatar:
#是否开启分享
share_jia: true
#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus;5、Gitment
#评论:1、多说;2、网易云跟帖;3、畅言;4、Disqus;5、Gitment; 6、Gitalk
#不需要使用某项,直接设置值为false,或注释掉
#具体请参考wiki:https://github.com/litten/hexo-theme-yilia/wiki/
Expand All @@ -179,6 +179,16 @@ gitment_oauth:
client_id: '' #client ID
client_secret: '' #client secret
#6、Gitalk
gitalk:
enable: true #用来做启用判断可以不用
owner: '' #Github 用户名
repo: '' #储存评论issue的github仓库名
admin: '' #Github 用户名
clientID: '' #Github Application clientID
clientSecret: '' #Github Application clientSecret
distractionFreeMode: '' #Facebook-like distraction free mode
# 样式定制 - 一般不需要修改,除非有很强的定制欲望…
style:
# 头像上面的背景颜色
Expand Down Expand Up @@ -211,5 +221,3 @@ friends:
aboutme: 很惭愧<br><br>只做了一点微小的工作<br>谢谢大家
```


18 changes: 14 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ reward_type: 2
# 打赏wording
reward_wording: '谢谢你请我吃糖果'
# 支付宝二维码图片地址,跟你设置头像的方式一样。比如:/assets/img/alipay.jpg
alipay:
alipay:
# 微信二维码图片地址
weixin:
weixin:

# 目录
# 目录设定:0-不显示目录; 1-文章对应的md文件里有toc:true属性,才有目录; 2-所有文章均显示目录
Expand All @@ -73,7 +73,7 @@ avatar:
#是否开启分享
share_jia: true

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

Expand All @@ -97,6 +97,16 @@ gitment_oauth:
client_id: '' #client ID
client_secret: '' #client secret

#6、Gitalk
gitalk:
enable: true #用来做启用判断可以不用
owner: '' #Github 用户名
repo: '' #储存评论issue的github仓库名
admin: '' #Github 用户名
clientID: '' #Github Application clientID
clientSecret: '' #Github Application clientSecret
distractionFreeMode: false #Facebook-like distraction free mode

# 样式定制 - 一般不需要修改,除非有很强的定制欲望…
style:
# 头像上面的背景颜色
Expand Down Expand Up @@ -127,4 +137,4 @@ friends:
友情链接5: http://localhost:4000/
友情链接6: http://localhost:4000/

aboutme: 很惭愧<br><br>只做了一点微小的工作<br>谢谢大家
aboutme: 很惭愧<br><br>只做了一点微小的工作<br>谢谢大家
11 changes: 10 additions & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
url: config.url+url_for(post.path)
}) %>
<% } %>

<% if (theme.wangyiyun){ %>
<%- partial('post/wangyiyun', {
key: post.slug,
Expand Down Expand Up @@ -129,4 +129,13 @@
url: config.url+url_for(post.path)
}) %>
<% } %>

<% if (theme.gitalk.owner && theme.gitalk.repo && theme.gitalk.enable && theme.gitalk.clientID && theme.gitalk.clientSecret){ %>
<%- partial('post/gitalk', {
key: post.slug,
title: post.title,
url: config.url+url_for(post.path)
}) %>
<% } %>

<% } %>
15 changes: 15 additions & 0 deletions layout/_partial/post/gitalk.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<div id="gitalk-container"></div>
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script type="text/javascript">
var gitalk = new Gitalk({
clientID: '<%= theme.gitalk.clientID %>',
clientSecret: '<%= theme.gitalk.clientSecret %>',
id: window.location.pathname,
repo: '<%= theme.gitalk.repo %>',
owner: '<%= theme.gitalk.owner %>',
admin: '<%= theme.gitalk.admin %>',
distractionFreeMode: '<%= theme.gitalk.distractionFreeMode %>'
})
gitalk.render('gitalk-container')
</script>
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, #gitment-ctn {
#disqus_thread, .duoshuo, .cloud-tie-wrapper, #SOHUCS, #gitment-ctn, #gitalk-container {
padding: 0 30px !important;
min-height: 20px;
}
Expand Down
2 changes: 1 addition & 1 deletion source/main.0cf68a.css

Large diffs are not rendered by default.

0 comments on commit 2a9fce1

Please sign in to comment.