jekyll-theme-h2o-ac 1.1.15 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/_layouts/post.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
- {% if post.language %}
3
- <html lang="{{post.language}}">
2
+ {% if post.lang %}
3
+ <html lang="{{post.lang}}">
4
4
  {% else %}
5
- <html lang="{{site.language}}">
5
+ <html lang="{{site.default_lang}}">
6
6
  {% endif %}
7
7
  {% include post-head.html %}
8
8
 
@@ -11,7 +11,9 @@
11
11
  {% else %}
12
12
  <body ontouchstart="">
13
13
  {% endif %}
14
-
14
+ {% assign lang = page.lang | default: site.default_lang %}
15
+ {% assign locales = site.data.locales[lang] %}
16
+ {% assign post = locales.post %}
15
17
  <!--[if lt IE 10]>
16
18
  <div class="alert-danger" role="alert">你的浏览器实在太太太旧了,放学别走,升级完浏览器再说!<a target="_blank" class="alert-link" href="http://browsehappy.com">立即升级</a></div>
17
19
  <![endif]-->
@@ -21,18 +23,10 @@
21
23
  <div id="all" class="post">
22
24
  {% endif %}
23
25
  <div class="alert-tip" id="no-previous">
24
- {% if site.language == 'zh-cn' %}
25
- 已经是最新一篇文章了!
26
- {% else %}
27
- Already the latest article!
28
- {% endif %}
26
+ {{ post.tips.left }}
29
27
  </div>
30
28
  <div class="alert-tip" id="no-next">
31
- {% if site.language == 'zh-cn' %}
32
- 已经是最后一篇文章了!
33
- {% else %}
34
- Already the last article!
35
- {% endif %}
29
+ {{ post.tips.right }}
36
30
  </div>
37
31
  <input id="nm-switch" type="hidden" value="{{ site.nightMode }}"> {% include header.html %}
38
32
 
@@ -68,67 +62,36 @@
68
62
  </svg>
69
63
  <span class="update-at"></span>
70
64
  </time>
71
- {% if site.language == 'zh-cn' %}
72
65
  <span class="post-meta-item">
73
66
  <svg class="icon words" aria-hidden="true">
74
67
  <use xlink:href="#icon-words"></use>
75
68
  </svg>
76
69
  {% assign total_size = page.content | strip_html | strip_newlines | remove: " " | size %}
77
- 本文总共 {% if total_size < 1000 %} {{ total_size }} {% else %} {{ total_size | divided_by: 1000.0 | round: 1 }}k {% endif %}
78
- </span>
79
- <span class="post-meta-item">
80
- <svg class="icon time" aria-hidden="true">
81
- <use xlink:href="#icon-time"></use>
82
- </svg>
83
- 阅读全文大约需要 {{ page.content | strip_html | strip_newlines | remove: " " | size | divided_by: 350 | plus: 1 }} 分钟
84
- </span>
85
- {% if site.busuanzi %}
86
- <span class="post-meta-item">
87
- <svg class="icon pv" aria-hidden="true">
88
- <use xlink:href="#icon-pv"></use>
89
- </svg>
90
- 本文总阅读量 <span id="busuanzi_value_page_pv"></span> 次
91
- </span>
92
- {% endif %}
93
- {% else %}
94
- <span class="post-meta-item">
95
- <svg class="icon words" aria-hidden="true">
96
- <use xlink:href="#icon-words"></use>
97
- </svg>
98
- There are {{ page.content | strip_html | strip_newlines | remove: " " | size }} words totally
70
+ {{ post.cover.total.info }} {% if total_size < 1000 %} {{ total_size }} {% else %} {{ total_size | divided_by: 1000.0 | round: 1 }}k {% endif %} {{ post.cover.total.unit }}
99
71
  </span>
100
72
  <span class="post-meta-item">
101
73
  <svg class="icon time" aria-hidden="true">
102
74
  <use xlink:href="#icon-time"></use>
103
75
  </svg>
104
- It may needs {{ page.content | strip_html | strip_newlines | remove: " " | size | divided_by: 350 | plus: 1 }} minutes
76
+ {{ post.cover.time.info }} {{ page.content | strip_html | strip_newlines | remove: " " | size | divided_by: 350 | plus: 1 }} {{ post.cover.time.unit }}
105
77
  </span>
106
78
  {% if site.busuanzi %}
107
79
  <span class="post-meta-item">
108
80
  <svg class="icon pv" aria-hidden="true">
109
81
  <use xlink:href="#icon-pv"></use>
110
82
  </svg>
111
- Total pageviews <span id="busuanzi_value_page_pv"></span>
83
+ {{ post.cover.view.info }} <span id="busuanzi_value_page_pv"></span> {{ post.cover.view.unit }}
112
84
  </span>
113
85
  {% endif %}
114
- {% endif %}
115
- {% if page.cover_author %}
86
+ {% if page.cover_author %}
116
87
  <span class="post-meta-item">
117
88
  <svg class="icon" aria-hidden="true">
118
89
  <use xlink:href="#icon-image"></use>
119
90
  </svg>
120
91
  {% if page.cover_author_link %}
121
- {% if site.language == 'zh-cn' %}
122
- 封面图片由 <a href="{{ page.cover_author_link }}" target="_blank">{{ page.cover_author }}</a> 提供
123
- {% else %}
124
- Cover is provided by <a href="{{ page.cover_author_link }}" target="_blank">{{ page.cover_author }}</a>
125
- {% endif %}
92
+ {{ locales.cover }} <a href="{{ page.cover_author_link }}" target="_blank">{{ page.cover_author }}</a>
126
93
  {% else %}
127
- {% if site.language == 'zh-cn' %}
128
- 封面图片由 {{ page.cover_author }} 提供
129
- {% else %}
130
- Cover is provided by {{ page.cover_author }}
131
- {% endif %}
94
+ {{ locales.cover }} {{ page.cover_author }}
132
95
  {% endif %}
133
96
  </span>
134
97
  {% endif %}
@@ -144,34 +107,58 @@
144
107
  <h2 class="post-subtitle">{{ page.subtitle }}</h2>
145
108
  {% endif %}
146
109
 
110
+ {% assign copyright = post.copyright %}
147
111
  {% if site.toc %}
148
112
  <div class="container">
149
113
  <div class="contents">
150
114
  <article class="markdown-body">
151
- {{ page.content | extlinks }}
115
+ {{ page.content }}
152
116
  <div class="post-copyright">
153
- <p><span>版权声明:</span>如无特别声明,本文版权归&nbsp;<a href="{{ site.url }}">{{ site.title }}</a>&nbsp;所有,转载请注明本文链接。</p>
154
- {% if site.cclicense %}<p>(采用 <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="extlinks">CC BY-NC-SA 4.0</a> 许可协议进行授权)</p>{% endif %}
155
- <p><span>本文标题:</span>《 {{ page.title }} 》</p>
156
- <p><span>本文链接:</span><a href="{{ page.url | prepend: site.url }}">{{ page.url | prepend: site.url }}</a></p>
117
+ <p>
118
+ <span>{{ copyright.statement.name }}:</span>
119
+ {{ copyright.statement.left }}
120
+ <a href="{{ site.url }}">{{ site.title }}</a>
121
+ {{ copyright.statement.middle }}
122
+ </p>
123
+ {% if site.cclicense %}
124
+ <p>
125
+ {{ copyright.statement.right1 }}
126
+ <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="extlinks">CC BY-NC-SA 4.0</a>
127
+ {{ copyright.statement.right2 }}
128
+ </p>
129
+ {% endif %}
130
+ <p><span>{{ copyright.title }}:</span>《 {{ page.title }} 》</p>
131
+ <p><span>{{ copyright.link }}:</span><a href="{{ page.url | prepend: site.url }}">{{ page.url | prepend: site.url }}</a></p>
132
+ <p class="tips">{{ copyright.statement.outdate1 }} <span></span> {{ copyright.statement.outdate2 }}</p>
157
133
  </div>
158
134
  </article>
159
135
  </div>
160
136
  <div class="table-of-contents">
161
- <h2>Contents</h2>
137
+ <h2>{{ post.outline }}</h2>
162
138
  {% include toc.html html=content %}
163
139
  </div>
164
140
  </div>
165
141
  {% else %}
166
142
  <article class="markdown-body">
167
-
168
- <span class="post-meta-item">Cover is provided by {{ page.cover_author }}</span>
169
143
  {{ page.content }}
170
144
  <div class="post-copyright">
171
- <p><span>版权声明:</span>如无特别声明,本文版权归&nbsp;<a href="{{ site.url }}">{{ site.title }}</a>&nbsp;所有,转载请注明本文链接。</p>
172
- {% if site.cclicense %}<p>(采用 <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="extlinks">CC BY-NC-SA 4.0</a> 许可协议进行授权)</p>{% endif %}
173
- <p><span>本文标题:</span>《 {{ page.title }} 》</p>
174
- <p><span>本文链接:</span><a href="{{ page.url | prepend: site.url }}">{{ page.url | prepend: site.url }}</a></p>
145
+ {% assign copyright = post.copyright %}
146
+ <p>
147
+ <span>{{ copyright.statement.name }}:</span>
148
+ {{ copyright.statement.left }}
149
+ <a href="{{ site.url }}">{{ site.title }}</a>
150
+ {{ copyright.statement.middle }}
151
+ </p>
152
+ {% if site.cclicense %}
153
+ <p>
154
+ {{ copyright.statement.right1 }}
155
+ <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="extlinks">CC BY-NC-SA 4.0</a>
156
+ {{ copyright.statement.right2 }}
157
+ </p>
158
+ {% endif %}
159
+ <p><span>{{ copyright.title }}:</span>《 {{ page.title }} 》</p>
160
+ <p><span>{{ copyright.link }}:</span><a href="{{ page.url | prepend: site.url }}">{{ page.url | prepend: site.url }}</a></p>
161
+ <p class="tips">{{ copyright.statement.outdate1 }} <span></span> {{ copyright.statement.outdate2 }}</p>
175
162
  </div>
176
163
  </article>
177
164
  {% endif %}
@@ -241,7 +228,7 @@
241
228
  <svg class="icon" aria-hidden="true">
242
229
  <use xlink:href="#icon-comment"></use>
243
230
  </svg>
244
- <span>评论</span>
231
+ <span>{{ locales.post.comment }}</span>
245
232
  </div>
246
233
  {% if site.comments.disqus and site.comments.waline %}
247
234
  <div id="comments-switch">
@@ -282,7 +269,7 @@
282
269
  {% endif%}
283
270
  </div>
284
271
 
285
- <script src="{{ "/assets/js/social-share.min.js" | relative_url }}"></script>
272
+ <script src="https://cdn.jsdelivr.net/npm/social-share.js@1.0.16/dist/js/social-share.min.js"></script>
286
273
  <script>
287
274
  socialShare('.social-share', {
288
275
  sites: [
@@ -324,7 +311,7 @@
324
311
  <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js"></script>
325
312
  <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
326
313
  <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
327
- <script src="{{ "/assets/js/index.min.js" | relative_url }}"></script>
314
+ <script src="{{ "/assets/js/app.min.js" | relative_url }}"></script>
328
315
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.min.js"></script>
329
316
  <script src="https://cdn.jsdelivr.net/npm/clipboard/dist/clipboard.min.js"></script>
330
317
  <script src="https://cdn.jsdelivr.net/npm/hotkeys-js/dist/hotkeys.min.js"></script>
@@ -416,8 +403,9 @@
416
403
  $('.post time span.update-at').html(local_update_at["date"]);
417
404
 
418
405
  var relative_time = dayjs().diff(local_update_at["date_org"], 'day');
406
+ $(".post-copyright .tips span").append(relative_time);
419
407
  if(relative_time > 365){
420
- $(".post-copyright").append("<p class='tips'>本文最后一次更新为 <span>" + relative_time + "</span> 天前,文章中的某些内容可能已过时!</p>");
408
+ $(".post-copyright .tips").addClass("active");
421
409
  }
422
410
  });
423
411
 
@@ -436,8 +424,6 @@
436
424
  window.location.href = previous_url;
437
425
  }else {
438
426
  $("#no-previous").addClass("active");
439
- console.log('已经是最新一篇文章了!');
440
- console.log('Already the latest article!');
441
427
  setTimeout(function(){$("#no-previous").removeClass("active");}, 1500);
442
428
  }
443
429
  });
@@ -450,8 +436,6 @@
450
436
  window.location.href = next_url;
451
437
  }else {
452
438
  $("#no-next").addClass("active");
453
- console.log('已经是最后一篇文章了!');
454
- console.log('Already the last article!');
455
439
  setTimeout(function(){$("#no-next").removeClass("active");}, 1500);
456
440
  }
457
441
  });