hexo-theme-stellar 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/_config.yml +107 -33
  2. package/layout/404.ejs +1 -1
  3. package/layout/_partial/cover/index.ejs +12 -0
  4. package/layout/_partial/cover/post_cover.ejs +19 -0
  5. package/layout/_partial/{main/article → cover}/wiki_cover.ejs +1 -4
  6. package/layout/_partial/head.ejs +3 -2
  7. package/layout/_partial/main/article/article_footer.ejs +4 -4
  8. package/layout/_partial/main/post_list/paginator.ejs +2 -2
  9. package/layout/_partial/main/post_list/post_card.ejs +43 -5
  10. package/layout/_partial/main/post_list/wiki_card.ejs +2 -0
  11. package/layout/_partial/plugins/comments/valine/script.ejs +1 -1
  12. package/layout/_partial/plugins/comments/waline/layout.ejs +19 -0
  13. package/layout/_partial/plugins/comments/waline/script.ejs +22 -0
  14. package/layout/_partial/scripts/index.ejs +7 -1
  15. package/layout/_partial/sidebar/widgets/recent.ejs +5 -13
  16. package/layout/index.ejs +5 -2
  17. package/layout/layout.ejs +1 -1
  18. package/layout/post.ejs +6 -2
  19. package/package.json +1 -1
  20. package/scripts/events/index.js +5 -7
  21. package/scripts/tags/grid.js +35 -0
  22. package/scripts/tags/image.js +21 -1
  23. package/scripts/tags/note.js +7 -22
  24. package/scripts/tags/poetry.js +48 -0
  25. package/scripts/tags/quot.js +51 -0
  26. package/scripts/tags/{site.js → sites.js} +3 -0
  27. package/source/css/_common/device.styl +1 -1
  28. package/source/css/_common/highlight.styl +1 -1
  29. package/source/css/_common/title.styl +3 -1
  30. package/source/css/_custom.styl +6 -5
  31. package/source/css/_layout/layout.styl +2 -2
  32. package/source/css/_layout/list.styl +70 -36
  33. package/source/css/_layout/main.styl +2 -2
  34. package/source/css/_layout/md.styl +36 -8
  35. package/source/css/_layout/pages/archives.styl +1 -0
  36. package/source/css/_layout/partial/cover.styl +50 -10
  37. package/source/css/_layout/sidebar/sidebar.styl +20 -4
  38. package/source/css/_layout/tag-plugins/folding.styl +1 -0
  39. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  40. package/source/css/_layout/tag-plugins/image.styl +1 -2
  41. package/source/css/_layout/tag-plugins/inline-labels.styl +3 -0
  42. package/source/css/_layout/tag-plugins/poetry.styl +50 -0
  43. package/source/css/_layout/tag-plugins/quot.styl +82 -0
  44. package/source/css/_plugins/fancybox.styl +5 -0
  45. package/source/css/_plugins/index.styl +2 -0
  46. package/source/js/main.js +60 -13
  47. package/source/js/plugins/friends.js +1 -1
  48. package/source/js/plugins/sites.js +2 -2
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.6.0'
3
+ version: '1.8.0'
4
4
  homepage: 'https://xaoxuu.com/wiki/stellar/'
5
5
  repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
6
6
  cdn_css: # Use cdn links instead of /css/main.css
@@ -30,8 +30,6 @@ sidebar:
30
30
  post: [toc, repo_info] # for pages using 'layout:post'
31
31
  wiki: [toc, repo_info, wiki_more] # for pages using 'layout:wiki'
32
32
  widgets:
33
- # default layout in home/wiki/categories/tags/archives pages
34
- # default_layout: [welcome]
35
33
  # Recent update
36
34
  recent:
37
35
  layout: recent
@@ -89,7 +87,7 @@ article:
89
87
 
90
88
  ######## Comments ########
91
89
  comments:
92
- service: # beaudar, utterances, valine, twikoo
90
+ service: # beaudar, utterances, valine, twikoo, waline
93
91
  # beaudar
94
92
  # https://beaudar.lipk.org/
95
93
  beaudar:
@@ -112,7 +110,7 @@ comments:
112
110
  theme: preferred-color-scheme
113
111
  label:
114
112
  valine:
115
- js: https://cdn.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
113
+ js: https://fastly.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
116
114
  appId: # your appId
117
115
  appKey: # your appKey
118
116
  placeholder:
@@ -136,23 +134,69 @@ comments:
136
134
  # Twikoo
137
135
  # https://twikoo.js.org/
138
136
  twikoo:
139
- js: https://cdn.jsdelivr.net/npm/twikoo@1.4.0/dist/twikoo.all.min.js # 建议锁定版本
137
+ js: https://fastly.jsdelivr.net/npm/twikoo@1.4.0/dist/twikoo.all.min.js # 建议锁定版本
140
138
  envId: https://xxx # vercel函数
139
+ waline:
140
+ js: https://unpkg.com/@waline/client@v2/dist/waline.js
141
+ css: https://unpkg.com/@waline/client@v2/dist/waline.css
142
+ # Waline server address url, you should set this to your own link
143
+ serverURL:
144
+
145
+ # If false, comment count will only be displayed in post page, not in home page
146
+ commentCount: true
147
+
148
+ # Pageviews count, Note: You should not enable both `waline.pageview` and `leancloud_visitors`.
149
+ pageview: false
150
+
151
+ # Custom locales
152
+ # locale:
153
+ # placeholder: Welcome to comment # Comment box placeholder
154
+
155
+ # Custom emoji
156
+ # emoji:
157
+ # - https://unpkg.com/@waline/emojis@1.0.1/weibo
158
+ # - https://unpkg.com/@waline/emojis@1.0.1/alus
159
+ # - https://unpkg.com/@waline/emojis@1.0.1/bilibili
160
+ # - https://unpkg.com/@waline/emojis@1.0.1/qq
161
+ # - https://unpkg.com/@waline/emojis@1.0.1/tieba
162
+ # - https://unpkg.com/@waline/emojis@1.0.1/tw-emoji
163
+
164
+ # Comment infomation, valid meta are nick, mail and link
165
+ # meta:
166
+ # - nick
167
+ # - mail
168
+ # - link
169
+
170
+ # Set required meta field, e.g.: [nick] | [nick, mail]
171
+ # requiredMeta:
172
+ # - nick
173
+
174
+ # Language, available values: en-US, zh-CN, zh-TW, pt-BR, ru-RU, jp-JP
175
+ # lang: zh-CN
176
+
177
+ # Word limit, no limit when setting to 0
178
+ # wordLimit: 0
179
+
180
+ # Whether enable login, can choose from 'enable', 'disable' and 'force'
181
+ # login: enable
182
+
183
+ # comment per page
184
+ # pageSize: 10
141
185
 
142
186
  ######## Footer ########
143
187
  footer:
144
188
  social:
145
189
  # github:
146
- # icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/08a41b181ce68.svg"/>'
190
+ # icon: '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/08a41b181ce68.svg"/>'
147
191
  # url: /
148
192
  # music:
149
- # icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3845874.svg"/>'
193
+ # icon: '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3845874.svg"/>'
150
194
  # url: /
151
195
  # unsplash:
152
- # icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3616429.svg"/>'
196
+ # icon: '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3616429.svg"/>'
153
197
  # url: /
154
198
  # comments:
155
- # icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/942ebbf1a4b91.svg"/>'
199
+ # icon: '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/942ebbf1a4b91.svg"/>'
156
200
  # url: /about/#comments
157
201
  sitemap:
158
202
  # '博客':
@@ -181,28 +225,31 @@ tag_plugins:
181
225
  # {% checkbox %}
182
226
  checkbox:
183
227
  interactive: false # enable interactive for user
228
+ # {% quot %}
229
+ quot:
230
+ default: # 可以自行配置多种图标方案
231
+ prefix: https://s2.loli.net/2022/01/04/vsTB5pGrIHfPxSj.png
232
+ suffix: https://s2.loli.net/2022/01/04/NORdtjlAhifZSns.png
233
+ hashtag:
234
+ prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
235
+ # {% emoji %}
184
236
  emoji:
185
- default: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
186
- twemoji: https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/svg/%s.svg
187
- qq: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
188
- aru: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/aru-l/%s.gif
189
- tieba: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/tieba/%s.png
237
+ default: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
238
+ twemoji: https://fastly.jsdelivr.net/gh/twitter/twemoji/assets/svg/%s.svg
239
+ qq: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
240
+ aru: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/aru-l/%s.gif
241
+ tieba: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/tieba/%s.png
242
+ # {% image %}
243
+ image:
244
+ fancybox: # true, false
190
245
 
191
246
 
192
247
  ######## JS Plugins ########
193
248
  plugins:
194
249
  ## required plugins ##
195
250
  # jquery
196
- jquery: https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
251
+ jquery: https://fastly.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
197
252
 
198
- ## lazyload plugins ##
199
- # fancybox
200
- fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css
201
- # swiper
202
- swiper:
203
- enable: true
204
- css: https://unpkg.com/swiper@6/swiper-bundle.min.css
205
- js: https://unpkg.com/swiper@6/swiper-bundle.min.js
206
253
  # issues api
207
254
  sitesjs: /js/plugins/sites.js
208
255
  friendsjs: /js/plugins/friends.js
@@ -212,25 +259,52 @@ plugins:
212
259
  preload:
213
260
  enable: true
214
261
  service: flying_pages # instant_page, flying_pages
215
- instant_page: https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@4.1.2/js/instant_page.js
216
- flying_pages: https://cdn.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js
262
+ instant_page: https://fastly.jsdelivr.net/gh/volantis-x/cdn-volantis@4.1.2/js/instant_page.js
263
+ flying_pages: https://fastly.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js
217
264
 
218
265
  # image lazyload
219
266
  # https://www.npmjs.com/package/vanilla-lazyload
220
267
  lazyload:
221
268
  enable: true # [hexo clean && hexo s] is required after changing this value.
222
- js: https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js
269
+ js: https://fastly.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js
223
270
  transition: blur # blur, fade
224
271
 
225
272
  # https://scrollrevealjs.org/api/reveal.html
226
273
  scrollreveal:
227
274
  enable: #true
228
- js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.9/dist/scrollreveal.min.js
275
+ js: https://fastly.jsdelivr.net/npm/scrollreveal@4.0.9/dist/scrollreveal.min.js
229
276
  distance: 8px
230
277
  duration: 500 # ms
231
278
  interval: 100 # ms
232
279
  scale: 1 # 0.1~1
233
280
 
281
+ # https://fancyapps.com/docs/ui/fancybox/
282
+ # available for {% image xxx %}
283
+ fancybox:
284
+ enable: true
285
+ js: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js
286
+ css: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css
287
+ # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
288
+ # 使用valine评论可以写: .vcontent img:not(.vemoji)
289
+ # 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
290
+ # 使用waline评论可以写: #waline_container .vcontent img
291
+ selector: .swiper-slide img # 多个选择器用英文逗号隔开
292
+
293
+ # swiper
294
+ swiper:
295
+ enable: true
296
+ css: https://unpkg.com/swiper@6/swiper-bundle.min.css
297
+ js: https://unpkg.com/swiper@6/swiper-bundle.min.js
298
+
299
+
300
+ # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
301
+ # https://github.com/sivan/heti
302
+ heti:
303
+ enable: false
304
+ css: https://unpkg.com/heti/umd/heti.min.css
305
+ js: https://unpkg.com/heti/umd/heti-addon.min.js
306
+
307
+
234
308
  style:
235
309
  darkmode: auto # auto / always / false
236
310
  theme:
@@ -238,12 +312,12 @@ style:
238
312
  dark: '#313438'
239
313
  animated_avatar:
240
314
  animate: auto # auto, always
241
- background: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
315
+ background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
242
316
  codeblock:
243
317
  scrollbar: 4px
244
318
 
245
319
  default:
246
- avatar: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
247
- link: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg
248
- cover: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg
249
- image: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/image/2659360.svg
320
+ avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
321
+ link: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg
322
+ cover: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg
323
+ image: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/image/2659360.svg
package/layout/404.ejs CHANGED
@@ -6,7 +6,7 @@ page.header = false;
6
6
  page.robots = 'none';
7
7
  %>
8
8
  <article class='md error-page'>
9
- <h1><img id='error' src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/404/1c830bfcd517d.svg' alt='404'></h1>
9
+ <h1><img id='error' src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/404/1c830bfcd517d.svg' alt='404'></h1>
10
10
  <p class='what'>
11
11
  <strong>
12
12
  <%- __('page.error.what') %>
@@ -0,0 +1,12 @@
1
+ <%
2
+ function layoutCover() {
3
+ if (page.layout == 'wiki') {
4
+ return partial('wiki_cover');
5
+ }
6
+ if (page.layout == 'post') {
7
+ return partial('post_cover');
8
+ }
9
+ return '';
10
+ }
11
+ %>
12
+ <%- layoutCover() %>
@@ -0,0 +1,19 @@
1
+ <%
2
+ function div() {
3
+ var el = '';
4
+ if (page.banner == undefined || page.banner == false) {
5
+ return el;
6
+ }
7
+ el += '<div class="l_cover post' + scrollreveal() + '">';
8
+ el += '<div class="cover">';
9
+ if (theme.plugins.lazyload && theme.plugins.lazyload.enable) {
10
+ el += '<div class="lazy img bg" data-bg="' + page.banner + '"></div>';
11
+ } else {
12
+ el += '<div class="lazy img bg" style="background-image:url(&quot;' + page.banner + '&quot;)"></div>';
13
+ }
14
+ el += '</div>';
15
+ el += '</div>';
16
+ return el;
17
+ }
18
+ %>
19
+ <%- div() %>
@@ -1,9 +1,6 @@
1
1
  <%
2
2
  function layoutWikiCover() {
3
3
  var el = '';
4
- if (page.layout !== 'wiki') {
5
- return el;
6
- }
7
4
  let proj = theme.wiki.projects[page.wiki];
8
5
  if (proj == undefined) {
9
6
  return el;
@@ -21,7 +18,7 @@ function layoutWikiCover() {
21
18
  if (cover === true) {
22
19
  cover = ['logo', 'title', 'description'];
23
20
  }
24
- el += '<div class="l_cover' + scrollreveal() + '">';
21
+ el += '<div class="l_cover wiki' + scrollreveal() + '">';
25
22
  el += '<article class="cover-wrap md">';
26
23
 
27
24
  if (logo && logo.src && cover.includes('logo')) {
@@ -49,8 +49,9 @@ function og_args() {
49
49
  <%- generate_robots() %>
50
50
 
51
51
  <meta http-equiv='x-dns-prefetch-control' content='on' />
52
- <link rel='dns-prefetch' href='https://cdn.jsdelivr.net'>
53
- <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
52
+ <link rel='dns-prefetch' href='https://fastly.jsdelivr.net'>
53
+ <link rel="preconnect" href="https://fastly.jsdelivr.net" crossorigin>
54
+ <link rel='dns-prefetch' href='//unpkg.com'>
54
55
 
55
56
  <meta name="renderer" content="webkit">
56
57
  <meta name="force-rendering" content="webkit">
@@ -85,13 +85,13 @@ function layoutDiv() {
85
85
  }
86
86
  el += '>';
87
87
  if (item == 'wechat') {
88
- el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/b32ef3da1162a.svg"/>';
88
+ el += '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/b32ef3da1162a.svg"/>';
89
89
  } else if (item == 'weibo') {
90
- el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/80c07e4dbb303.svg"/>';
90
+ el += '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/80c07e4dbb303.svg"/>';
91
91
  } else if (item == 'email') {
92
- el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/a1b00e20f425d.svg"/>';
92
+ el += '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/a1b00e20f425d.svg"/>';
93
93
  } else if (item == 'link') {
94
- el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/8411ed322ced6.svg"/>';
94
+ el += '<img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/8411ed322ced6.svg"/>';
95
95
  }
96
96
  el += '</a>';
97
97
  }
@@ -1,13 +1,13 @@
1
1
  <% if (is_home() && page.total > 1) { %>
2
2
  <div class='paginator-wrap dis-select'>
3
3
  <a class='paginator prev<%- page.prev != 0 ? "" : " disable" %>' href='<%- url_for(page.prev_link) %>'>
4
- <img src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/f049bbd4e88ec.svg'/>
4
+ <img src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/f049bbd4e88ec.svg'/>
5
5
  </a>
6
6
  <div class='paginator current'>
7
7
  <%- page.current %><span class='sep'></span><%- page.total %>
8
8
  </div>
9
9
  <a class='paginator next<%- page.next != 0 ? "" : " disable" %>' href='<%- url_for(page.next_link) %>'>
10
- <img src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/064b95430caf4.svg'/>
10
+ <img src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/064b95430caf4.svg'/>
11
11
  </a>
12
12
  </div>
13
13
  <% } %>
@@ -1,6 +1,8 @@
1
1
  <%
2
- function layoutDiv() {
2
+ function div_default() {
3
3
  var el = '';
4
+ el += '<article class="md">';
5
+
4
6
  // 封面
5
7
  if (post.cover || theme.article.auto_cover) {
6
8
  var cover_url;
@@ -38,7 +40,11 @@ function layoutDiv() {
38
40
  el += '</h2>';
39
41
 
40
42
  // 摘要
41
- el += '<div class="excerpt">';
43
+ el += '<div class="excerpt';
44
+ if (theme.plugins.heti && theme.plugins.heti.enable) {
45
+ el += ' heti';
46
+ }
47
+ el += '">';
42
48
  el += '<p>';
43
49
  if (post.excerpt) {
44
50
  el += strip_html(post.excerpt);
@@ -74,11 +80,43 @@ function layoutDiv() {
74
80
  }
75
81
  }
76
82
  if (post.pin) {
77
- el += '<span class="pin"><img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/badge/3279dd441df8b.svg"/></span>';
83
+ el += '<span class="pin"><img src="https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/badge/3279dd441df8b.svg"/></span>';
78
84
  }
79
- el += '<div>';
85
+ el += '</div>';
86
+ el += '</article>';
87
+ return el;
88
+ }
89
+ function div_photo() {
90
+ var el = '';
91
+ el += '<div class="cover">';
92
+ el += '<img src="' + post.cover + '"/>';
93
+ if (post.cover_info) {
94
+ el += '<div class="cover-info"';
95
+ if (post.cover_info.meta) {
96
+ el += 'position="top">';
97
+ } else {
98
+ el += 'position="bottom">';
99
+ }
100
+ if (post.cover_info.meta) {
101
+ el += '<div class="cap">' + post.cover_info.meta + '</div>';
102
+ }
103
+ if (post.cover_info.title) {
104
+ el += '<div class="title">' + post.cover_info.title + '</div>';
105
+ }
106
+ if (post.cover_info.subtitle) {
107
+ el += '<div class="cap">' + post.cover_info.subtitle + '</div>';
108
+ }
109
+ el += '</div>';
80
110
 
111
+ }
112
+ el += '</div>';
81
113
  return el;
82
114
  }
115
+ function div() {
116
+ if (post.cover && post.cover.length > 0 && post.cover_info != undefined) {
117
+ return div_photo();
118
+ }
119
+ return div_default();
120
+ }
83
121
  %>
84
- <%- layoutDiv() %>
122
+ <%- div() %>
@@ -1,6 +1,7 @@
1
1
  <%
2
2
  function layoutDiv() {
3
3
  var el = '';
4
+ el += '<article class="md">';
4
5
  if (proj.logo && proj.logo.src) {
5
6
  el += '<div class="preview">';
6
7
  el += '<img src="' + proj.logo.src + '" alt="logo"';
@@ -20,6 +21,7 @@ function layoutDiv() {
20
21
  el += '<p>' + proj.description + '</p>';
21
22
  }
22
23
  el += '</div>';
24
+ el += '</article>';
23
25
  return el;
24
26
  }
25
27
  %>
@@ -35,7 +35,7 @@
35
35
  el: '#valine_container',
36
36
  path: path,
37
37
  placeholder: placeholder,
38
- emojiCDN: 'https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/',
38
+ emojiCDN: 'https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/',
39
39
  emojiMaps: getEmojiMaps(),
40
40
  }));
41
41
  });
@@ -0,0 +1,19 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ el += '<div id="waline_container" class="waline_thread"';
5
+ let cfg = {};
6
+ if (page.comment_id) {
7
+ cfg['comment_id'] = page.comment_id;
8
+ }
9
+ for (let key of Object.keys(cfg)) {
10
+ if (cfg[key]) {
11
+ el += ' ' + key + '="' + cfg[key] + '"';
12
+ }
13
+ }
14
+ el += '><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg></div>';
15
+ return el;
16
+ }
17
+ %>
18
+
19
+ <%- layoutDiv() %>
@@ -0,0 +1,22 @@
1
+ <script>
2
+ function load_comment(){
3
+ if(!document.getElementById("waline_container"))return;
4
+ stellar.loadCSS('<%- theme.comments.waline.css %>');
5
+ stellar.loadScript('<%- theme.comments.waline.js %>', {defer:true}).then(function () {
6
+ const el = document.getElementById("waline_container");
7
+ var path = el.getAttribute('comment_id');
8
+ if (!path) {
9
+ path = decodeURI(window.location.pathname);
10
+ }
11
+ Waline.init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
12
+ el: '#waline_container',
13
+ path: path,
14
+ }));
15
+ });
16
+ }
17
+ window.addEventListener('DOMContentLoaded', (event) => {
18
+ console.log('DOM fully loaded and parsed');
19
+ load_comment();
20
+ });
21
+
22
+ </script>
@@ -103,7 +103,7 @@
103
103
 
104
104
  // required plugins (only load if needs)
105
105
  stellar.plugins = {
106
- jQuery: '<%- url_for(theme.plugins.jquery || "https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>',
106
+ jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>',
107
107
  sitesjs: '<%- url_for(theme.plugins.sitesjs) %>',
108
108
  friendsjs: '<%- url_for(theme.plugins.friendsjs) %>',
109
109
  };
@@ -121,6 +121,12 @@
121
121
  if ('<%- theme.plugins.preload.enable %>' == 'true') {
122
122
  stellar.plugins.preload = Object.assign(<%- JSON.stringify(theme.plugins.preload) %>);
123
123
  }
124
+ if ('<%- theme.plugins.fancybox.enable %>' == 'true') {
125
+ stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>);
126
+ }
127
+ if ('<%- theme.plugins.heti.enable %>' == 'true') {
128
+ stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>);
129
+ }
124
130
  </script>
125
131
 
126
132
  <!-- required -->
@@ -27,29 +27,21 @@ function layoutDiv() {
27
27
  }
28
28
  el += '<div class="widget-body fs14">';
29
29
  arr.sort("updated", -1).limit(item.limit).each(function(post) {
30
- el += '<div class="line"></div>'
31
- el += '<a class="more-item" href="' + url_for(post.link || post.path) + '">';
32
- el += '<div class="cap">';
33
- el += '<time>' + date(post.updated, config.date_format) + '</time>';
30
+ el += '<div class="more-item">';
31
+ el += '<a class="title" href="' + url_for(post.link || post.path) + '">';
34
32
  if (post.layout == 'wiki') {
35
33
  el += '<span>';
36
34
  let proj = theme.wiki.projects[post.wiki];
37
35
  if (proj && proj.title) {
38
- el += proj.title;
36
+ el += proj.title + __('symbol.colon');
39
37
  } else if (post.wiki) {
40
- el += post.wiki;
38
+ el += post.wiki + __('symbol.colon');
41
39
  }
42
40
  el += '</span>';
43
- } else {
44
- post.categories.limit(1).forEach((cat, i) => {
45
- el += '<span>' + cat.name + '</span>';
46
- });
47
41
  }
48
- el += '</div>';
49
- el += '<span class="title">';
50
42
  el += post.title || post.seo_title || post.wiki;
51
- el += '</span>';
52
43
  el += '</a>';
44
+ el += '</div>';
53
45
  el += '';
54
46
  });
55
47
  el += '</div>';
package/layout/index.ejs CHANGED
@@ -12,10 +12,13 @@ if (page.title && page.wiki) {
12
12
 
13
13
  function layout_post_card(layout, post, content) {
14
14
  var el = '';
15
+ var layout = layout;
16
+ if (layout == 'post' && post.cover != undefined && post.cover_info != undefined) {
17
+ layout += ' photo';
18
+ }
15
19
  el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
16
- el += '<article class="md">';
17
20
  el += content;
18
- el += '</article></a>';
21
+ el += '</a>';
19
22
  return el;
20
23
  }
21
24
 
package/layout/layout.ejs CHANGED
@@ -2,7 +2,7 @@
2
2
  <html lang='<%- page.lang %>'>
3
3
  <%- partial('_partial/head') %>
4
4
  <body>
5
- <%- partial('_partial/main/article/wiki_cover') %>
5
+ <%- partial('_partial/cover/index') %>
6
6
  <div class='l_body' id='start'>
7
7
  <aside class='l_left' layout='<%- page.layout %>'>
8
8
  <%- partial('_partial/sidebar/index') %>
package/layout/post.ejs CHANGED
@@ -13,10 +13,14 @@ function layoutTitle() {
13
13
  return '';
14
14
  }
15
15
  }
16
+ let post = page;
17
+ let heti = '';
18
+ if (theme.plugins.heti && theme.plugins.heti.enable) {
19
+ heti = ' heti';
20
+ }
16
21
  %>
17
- <% let post = page; %>
18
22
  <%- partial('_partial/main/navbar/breadcrumb') %>
19
- <article class='content md <%- post.layout %><%- scrollreveal() %>'>
23
+ <article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
20
24
  <%- layoutTitle() %>
21
25
  <%- post.content %>
22
26
  <%- partial('_partial/main/article/article_footer') %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -10,11 +10,9 @@ hexo.on('generateBefore', () => {
10
10
  });
11
11
 
12
12
  hexo.on('ready', () => {
13
- const { version } = require('../../package.json');
14
- hexo.log.info(`
15
- =======================================================
16
- Stellar ${version}
17
- Docs: https://xaoxuu.com/wiki/stellar/
18
- Repo: https://github.com/xaoxuu/hexo-theme-stellar/
19
- =======================================================`);
13
+ const { version, homepage, repository } = require('../../package.json');
14
+ hexo.log.info(`Welcome to Stellar ${version}
15
+ DOCS ${homepage}
16
+ REPO ${repository.url}
17
+ `);
20
18
  });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * grid.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% grid [color:color] [child:codeblock/tabs] title %}
6
+ * body
7
+ * {% endgrid %}
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ hexo.extend.tag.register('grid', function(args, content) {
13
+ args = hexo.args.map(args, ['color', 'child'], ['title']);
14
+ const color = args.color;
15
+ const title = args.title;
16
+ var el = '';
17
+ const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
18
+ if (!color && defaultColor) {
19
+ color = defaultColor;
20
+ }
21
+ // header
22
+ el += '<div class="tag-plugin note"';
23
+ el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
24
+ el += '>';
25
+ // title
26
+ if (title && title.length > 0) {
27
+ el += '<div class="title"><strong>' + title + '</strong></div>';
28
+ }
29
+ // content
30
+ el += '<div class="body">';
31
+ el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
32
+ el += '</div></div>';
33
+
34
+ return el;
35
+ }, {ends: true});