Skip to content

Commit 17d6245

Browse files
authored
Merge pull request iissnan#1381 from ivan-nginx/master
Fixes and enhancements. [7]
2 parents 73ed6d6 + daacd47 commit 17d6245

File tree

11 files changed

+141
-11
lines changed

11 files changed

+141
-11
lines changed

_config.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,13 @@ post_meta:
217217
created_at: true
218218
updated_at: false
219219
categories: true
220-
220+
221+
# Post wordcount display settings
222+
# Dependies: https://github.com/willin/hexo-wordcount
223+
post_wordcount:
224+
item_text: true
225+
wordcount: false
226+
min2read: false
221227

222228
# Wechat Subscriber
223229
#wechat_subscriber:
@@ -300,10 +306,13 @@ mathjax:
300306
# See: https://www.google.com/webmasters/
301307
#google_site_verification:
302308

303-
304309
# Google Analytics
305310
#google_analytics:
306311

312+
# Yandex Webmaster tools verification setting
313+
# See: https://webmaster.yandex.ru/
314+
#yandex_site_verification:
315+
307316
# CNZZ count
308317
#cnzz_siteid:
309318

@@ -339,6 +348,15 @@ facebook_comments_plugin:
339348
width: 100% # default width is 550px
340349
scheme: light # default scheme is light (light or dark)
341350

351+
# VKontakte API Support.
352+
# To get your AppID visit https://vk.com/editapp?act=create
353+
vkontakte_api:
354+
enable: false
355+
app_id: #<app_id>
356+
like: true
357+
comments: true
358+
num_of_posts: 10
359+
342360

343361
# Show number of visitors to each article.
344362
# You can visit https://leancloud.cn get AppID and AppKey.

languages/default.yml

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ title:
22
archive: Archive
33
category: Category
44
tag: Tag
5+
schedule: Schedule
56

67
author: Author
78

@@ -12,6 +13,7 @@ menu:
1213
tags: Tags
1314
about: About
1415
search: Search
16+
schedule: Schedule
1517
sitemap: Sitemap
1618

1719
sidebar:
@@ -28,6 +30,8 @@ post:
2830
untitled: Untitled
2931
toc_empty: This post does not have a Table of Contents
3032
visitors: Visitors
33+
wordcount: Words count in article
34+
min2read: Reading time
3135

3236
page:
3337
totally: Totally

languages/en.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
title:
22
archive: Archive
33
category: Category
4-
schedule: Schedule
54
tag: Tag
5+
schedule: Schedule
66

77
author: Author
88

99
menu:
1010
home: Home
1111
archives: Archives
1212
categories: Categories
13-
schedule: Schedule
1413
tags: Tags
1514
about: About
1615
search: Search
16+
schedule: Schedule
1717
sitemap: Sitemap
1818

1919
sidebar:
@@ -30,6 +30,8 @@ post:
3030
untitled: Untitled
3131
toc_empty: This post does not have a Table of Contents
3232
visitors: Visitors
33+
wordcount: Words count in article
34+
min2read: Reading time
3335

3436
page:
3537
totally: Totally

languages/ru.yml

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ title:
22
archive: Архив
33
category: Категория
44
tag: Тэг
5+
schedule: Календарь
56

67
author: Author
78

@@ -12,6 +13,7 @@ menu:
1213
tags: Тэги
1314
about: О сайте
1415
search: Поиск
16+
schedule: Календарь
1517
sitemap: Карта сайта
1618

1719
sidebar:
@@ -28,6 +30,8 @@ post:
2830
untitled: Без имени
2931
toc_empty: Эта запись без оглавления
3032
visitors: Просмотров
33+
wordcount: Кол-во слов в статье
34+
min2read: Время чтения в минутах
3135

3236
page:
3337
totally: Всего

layout/_macro/post.swig

+50-5
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@
172172
{% endif %}
173173
{% endif %}
174174

175-
{% if not is_index and theme.facebook_sdk.enable and theme.facebook_sdk.like_button %}
176-
<span class="post-meta-divider">|</span>
177-
<div class="fb-like" data-layout="button_count" data-share="true"></div>
178-
{% endif %}
179-
180175
{# LeanCould PageView #}
181176
{% if theme.leancloud_visitors.enable %}
182177
<span id="{{ url_for(post.path) }}" class="leancloud_visitors" data-flag-title="{{ post.title }}">
@@ -198,6 +193,38 @@
198193
</span>
199194
{% endif %}
200195

196+
{% if theme.post_wordcount.wordcount or theme.post_wordcount.min2read %}
197+
<div class="post-wordcount">
198+
{% if theme.post_wordcount.wordcount %}
199+
<span class="post-meta-item-icon">
200+
<i class="fa fa-file-word-o"></i>
201+
</span>
202+
{% if theme.post_wordcount.item_text %}
203+
<span class="post-meta-item-text">{{ __('post.wordcount') }}</span>
204+
{% endif %}
205+
<span title="{{ __('post.wordcount') }}" }}">
206+
{{ wordcount(post.content) }}
207+
</span>
208+
{% endif %}
209+
210+
{% if theme.post_wordcount.wordcount and theme.post_wordcount.min2read %}
211+
<span class="post-meta-divider">|</span>
212+
{% endif %}
213+
214+
{% if theme.post_wordcount.min2read %}
215+
<span class="post-meta-item-icon">
216+
<i class="fa fa-clock-o"></i>
217+
</span>
218+
{% if theme.post_wordcount.item_text %}
219+
<span class="post-meta-item-text">{{ __('post.min2read') }}</span>
220+
{% endif %}
221+
<span title="{{ __('post.min2read') }}" }}">
222+
{{ min2read(post.content) }}
223+
</span>
224+
{% endif %}
225+
</div>
226+
{% endif %}
227+
201228
{% if post.description and (not theme.excerpt_description or not is_index) %}
202229
<div class="post-description">
203230
{{ post.description }}
@@ -294,6 +321,24 @@
294321
</div>
295322
{% endif %}
296323

324+
{% if not is_index %}
325+
{% if (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
326+
<div class="social-like">
327+
{% if theme.vkontakte_api.enable and theme.vkontakte_api.like %}
328+
<div class="vk_like">
329+
<span id="vk_like"></span>
330+
</div>
331+
{% endif %}
332+
333+
{% if theme.facebook_sdk.enable and theme.facebook_sdk.like_button %}
334+
<div class="fb_like">
335+
<div class="fb-like" data-layout="button_count" data-share="true"></div>
336+
</div>
337+
{% endif %}
338+
</div>
339+
{% endif %}
340+
{% endif %}
341+
297342
{% if not is_index and (post.prev or post.next) %}
298343
<div class="post-nav">
299344
<div class="post-nav-next post-nav-item">

layout/_partials/comments.swig

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
data-width="{{ theme.facebook_comments_plugin.width }}"
1212
data-colorscheme="{{ theme.facebook_comments_plugin.scheme }}">
1313
</div>
14+
{% elseif theme.vkontakte_api.enable and theme.vkontakte_api.comments %}
15+
<div id="vk_comments"></div>
1416
{% elseif theme.disqus_shortname %}
1517
<div id="disqus_thread">
1618
<noscript>

layout/_partials/head.swig

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
{% endif %}
1414

1515

16+
{% if theme.yandex_site_verification %}
17+
<meta name="yandex-verification" content="{{ theme.yandex_site_verification }}" />
18+
{% endif %}
19+
20+
1621
{% if theme.baidu_site_verification %}
1722
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}" />
1823
{% endif %}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% include 'analytics/facebook-sdk.swig' %}
2+
{% include 'analytics/vkontakte-api.swig' %}
23
{% include 'analytics/google-analytics.swig' %}
34
{% include 'analytics/baidu-analytics.swig' %}
45
{% include 'analytics/tencent-analytics.swig' %}
56
{% include 'analytics/cnzz-analytics.swig' %}
6-
{% include 'analytics/application-insights.swig' %}
7+
{% include 'analytics/application-insights.swig' %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% if theme.vkontakte_api.enable %}
2+
3+
<div id="vk_api_transport"></div>
4+
<script type="text/javascript">
5+
window.vkAsyncInit = function() {
6+
VK.init({
7+
apiId: {{ theme.vkontakte_api.app_id }}
8+
});
9+
10+
{% if theme.vkontakte_api.like %}
11+
VK.Widgets.Like("vk_like", {type: "mini", height: 20});
12+
{% endif %}
13+
14+
{% if page.comments and theme.vkontakte_api.comments %}
15+
VK.Widgets.Comments("vk_comments", {limit: {{ theme.vkontakte_api.num_of_posts }}, attach: "*"});
16+
{% endif %}
17+
};
18+
setTimeout(function() {
19+
var el = document.createElement("script");
20+
el.type = "text/javascript";
21+
el.src = "//vk.com/js/api/openapi.js";
22+
el.async = true;
23+
document.getElementById("vk_api_transport").appendChild(el);
24+
}, 0);
25+
</script>
26+
27+
{% endif %}

source/css/_common/components/post/post-meta.styl

+22
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,25 @@
4343
.posts-expand .post-comments-count {
4444
+mobile() { display: none; }
4545
}
46+
.social-like {
47+
font-size: 14px;
48+
height: 20px;
49+
text-align: center;
50+
border-top: 1px solid #eee;
51+
padding-top: 9px;
52+
margin-top: 45px;
53+
display: flex;
54+
justify-content: center;
55+
}
56+
57+
.vk_like {
58+
width: 85px;
59+
height: 21px;
60+
padding-top: 7px;
61+
align-self: center;
62+
}
63+
64+
.fb_like {
65+
height: 30px;
66+
align-self: center;
67+
}

source/css/_common/components/post/post-nav.styl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.post-nav {
22
display: table;
3-
margin-top: 60px;
3+
margin-top: 15px;
44
width: 100%;
55
border-top: 1px solid $gainsboro;
66
}

0 commit comments

Comments
 (0)