Skip to content

Commit 3618730

Browse files
committed
Add Disqus, Share.js
1 parent c31b12e commit 3618730

20 files changed

+187
-32
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# H2O
1+
## H2O
22

33
[在线预览 →](http://liaokeyu.com/)
44

@@ -55,7 +55,8 @@ If you like this theme or using it, please give a ⭐️ for motivation ;)
5555
- 高级部分
5656
- [自定义](#自定义)
5757
- 集成服务
58-
- [Disqus](#Disqus) [Todo]
58+
- [Disqus](#Disqus)
59+
- [Share.js](#Share.js)
5960

6061
You can easily get started by modifying _config.yml
6162

@@ -95,6 +96,7 @@ tags: jekyll 前端开发 设计
9596
```
9697

9798
#### 导航
99+
98100
博客顶部的导航栏信息需要以下面的格式进行配置:
99101

100102
```
@@ -315,7 +317,24 @@ postPatterns: 'circuitBoard'
315317

316318
#### Disqus
317319

318-
待完成...
320+
[Disqus](https://disqus.com/)是一个第三方社交评论插件,体验相当不错。
321+
322+
模板默认开启Disqus评论插件,如需关闭请在 `_config.yml` 中配置参数 `true` (开启) 或者 `false` (关闭) :
323+
324+
```
325+
# Comments
326+
disqus: true
327+
```
328+
329+
#### Share.js
330+
331+
为了让文章更方便地分享,使用了第三方分享插件[Share.js](http://overtrue.me/share.js/),支持一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook、Twitter、Linkedin、Google+、点点等社交网站。
332+
333+
```
334+
# Share
335+
social-share: true # 开启或者关闭分享功能
336+
social-share-items: ['wechat', 'weibo', 'douban','twitter']
337+
```
319338

320339
### 贡献
321340

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ avatar: 'assets/img/profile.png'
1919
# Comments
2020
disqus: true
2121

22+
# Share
23+
social-share: true
24+
social-share-items: ['wechat', 'weibo', 'douban','twitter']
25+
2226
# theme color 主题皮肤
2327
theme-color: 'default' # pink or default
2428

_includes/head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<link rel="stylesheet" href="//at.alicdn.com/t/font_eo2tpip1om0lik9.css">
1616
<link rel="stylesheet" href="{{ "assets/css/github-markdown.css" | prepend: site.baseurl }}">
1717
<link rel="stylesheet" href="{{ "assets/css/prism.css" | prepend: site.baseurl }}">
18+
<link rel="stylesheet" href="{{ "assets/css/share.min.css" | prepend: site.baseurl }}">
1819
<link rel="stylesheet" href="{{ "assets/css/app.min.css" | prepend: site.baseurl }}">
1920
</head>

_layouts/post.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
3535
<article class="markdown-body">
3636
{{ page.content }}
3737
</article>
38+
{% if site.social-share %}
39+
<div class="social-share-wrapper">
40+
<div class="social-share"></div>
41+
</div>
42+
{% endif %}
3843
</div>
3944

4045
<section class="author-detail">
41-
<section class="author-card">
46+
<section class="post-footer-item author-card">
4247
<div class="avatar">
4348
<img src="{{ site.baseurl }}{{ site.avatar }}" alt="">
4449
</div>
@@ -58,7 +63,7 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
5863
</ul>
5964
{% endif %}
6065
</section>
61-
<section class="read-next">
66+
<section class="post-footer-item read-next">
6267
{% if page.next.url %}
6368
<div class="read-next-item">
6469
<a href="{{ page.next.url }}" class="read-next-link"></a>
@@ -87,11 +92,15 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
8792
{% endif %}
8893
</section>
8994
{% if site.disqus %}
90-
<section class="comment">
95+
<section class="post-footer-item comment">
9196
<div id="disqus_thread"></div>
9297
</section>
9398
{% endif %}
9499
</div>
100+
<script src="{{ site.baseurl }}assets/js/social-share.min.js"></script>
101+
<script>
102+
socialShare('.social-share', {sites: [{% for i in site.social-share-items %}'{{ i }}',{% endfor %}]});
103+
</script>
95104
<script>
96105
/**
97106
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.

_posts/2017-04-18-new-theme-h2o.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ tags: jekyll 前端开发 设计
9090
- Go
9191
- Python
9292
93+
### 评论功能
94+
95+
由于多说关闭,又对国内其他第三方评论插件无感,所以将[Disqus](https://disqus.com/)列为首选(目前模板也只提供了这个),请自备梯子。
96+
9397
### 移动端优化
9498
9599
响应式设计,对手机和平板等设备做了优化。
@@ -102,12 +106,6 @@ tags: jekyll 前端开发 设计
102106
103107
H2O在这方面还有很多需要完善的地方,比如:<strike>代码高亮</strike>、夜间模式、查看大图...
104108
105-
### 关于评论功能
106-
107-
我的博客主要分享技术类和生活类的内容,目前我的技术水平有限,文章质量也不算高,所以评论功能也没什么交流的意义,我会不定期在[掘金](https://juejin.im/user/57a6f434165abd006159b4cc)分享一些自认为不错的文章,可以去那里给我留言。
108-
109-
如果你打算使用H2O主题,自己搞不定Jekyll扩展评论功能的话,可以私信[我微博](http://weibo.com/1374146504/profile?topnav=1&wvr=6),或者上[Github提issue](https://github.com/kaeyleo/jekyll-theme-H2O/issues/new)。
110-
111109
### 其他特性:
112110
113111
- 增加了网页标题SEO优化

assets/css/app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/share.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/fonts/iconfont.eot

9.36 KB
Binary file not shown.

assets/fonts/iconfont.svg

Lines changed: 88 additions & 0 deletions
Loading

assets/fonts/iconfont.ttf

9.08 KB
Binary file not shown.

assets/fonts/iconfont.woff

6.21 KB
Binary file not shown.

assets/icons/author.svg

100644100755
File mode changed.

assets/icons/date.svg

100644100755
File mode changed.

assets/icons/logo.svg

100644100755
File mode changed.

assets/icons/logo_default.svg

100644100755
File mode changed.

assets/icons/logo_pink.svg

100644100755
File mode changed.

assets/js/social-share.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)