hexo-theme-stellar 1.20.0 → 1.22.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 (56) hide show
  1. package/README.md +3 -3
  2. package/_config.yml +26 -17
  3. package/languages/zh-CN.yml +1 -1
  4. package/languages/zh-TW.yml +1 -1
  5. package/layout/404.ejs +1 -1
  6. package/layout/_partial/cover/wiki_cover.ejs +9 -15
  7. package/layout/_partial/head.ejs +1 -1
  8. package/layout/_partial/main/article/article_footer.ejs +11 -16
  9. package/layout/_partial/main/navbar/breadcrumb.ejs +4 -4
  10. package/layout/_partial/main/post_list/post_card.ejs +1 -1
  11. package/layout/_partial/main/post_list/wiki_card.ejs +6 -11
  12. package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
  13. package/layout/_partial/sidebar/index.ejs +1 -1
  14. package/layout/_partial/widgets/ghuser.ejs +1 -1
  15. package/layout/_partial/widgets/related.ejs +12 -21
  16. package/layout/_partial/widgets/toc.ejs +5 -2
  17. package/layout/index.ejs +6 -7
  18. package/layout/post.ejs +1 -1
  19. package/layout/wiki.ejs +1 -1
  20. package/package.json +1 -1
  21. package/scripts/events/lib/doc_tree.js +24 -10
  22. package/scripts/helpers/category_color.js +18 -5
  23. package/scripts/tags/index.js +3 -1
  24. package/scripts/tags/lib/banner.js +67 -0
  25. package/scripts/tags/lib/{ablock.js → box.js} +3 -3
  26. package/scripts/tags/lib/gallery.js +58 -0
  27. package/scripts/tags/lib/navbar.js +15 -34
  28. package/scripts/tags/lib/swiper.js +1 -1
  29. package/scripts/tags/lib/timeline.js +3 -3
  30. package/source/css/_common/highlight.styl +1 -0
  31. package/source/css/_layout/list.styl +12 -4
  32. package/source/css/_layout/md.styl +1 -1
  33. package/source/css/_layout/partial/cover.styl +2 -0
  34. package/source/css/_layout/partial/paginator.styl +2 -2
  35. package/source/css/_layout/tag-plugins/banner.styl +107 -0
  36. package/source/css/_layout/tag-plugins/common.styl +5 -2
  37. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  38. package/source/css/_layout/tag-plugins/gallery.styl +95 -0
  39. package/source/css/_layout/tag-plugins/grid.styl +0 -9
  40. package/source/css/_layout/tag-plugins/note.styl +1 -0
  41. package/source/css/_layout/tag-plugins/timeline.styl +14 -1
  42. package/source/css/_layout/widgets/ghuser.styl +5 -6
  43. package/source/css/_layout/widgets/toc_common.styl +12 -1
  44. package/source/css/_plugins/copycode.styl +17 -6
  45. package/source/css/_plugins/fancybox.styl +4 -0
  46. package/source/css/_plugins/index.styl +2 -0
  47. package/source/css/{_layout/partial/ai_abstract.styl → _plugins/tianli_gpt.styl} +2 -2
  48. package/source/js/main.js +29 -4
  49. package/source/js/plugins/copycode.js +0 -4
  50. package/source/js/plugins/fcircle.js +3 -3
  51. package/source/js/plugins/friends.js +3 -3
  52. package/source/js/plugins/memos.js +133 -0
  53. package/source/js/plugins/sites.js +4 -4
  54. package/source/js/plugins/timeline.js +3 -3
  55. package/source/js/plugins/weibo.js +3 -3
  56. /package/layout/_partial/{main/article/ai_abstract.ejs → plugins/ai/tianli_gpt.ejs} +0 -0
package/README.md CHANGED
@@ -10,10 +10,10 @@ Stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富
10
10
  Check your environment:
11
11
 
12
12
  ```yaml
13
- Hexo: 5.4.0 ~ 6.3.0
13
+ Hexo: 6.3.0 ~ 7.0.0
14
14
  hexo-cli: 4.3.0 ~ latest
15
- node.js: 14.17.3 ~ 18.12.0
16
- npm: 6.14.13 ~ 8.19.2
15
+ node: 14.17.3 20.10.0 # 建议选择 LTS 版本,过高的版本 hexo 还没有进行兼容。
16
+ npm: 6.14.13 ~ 10.2.3
17
17
  ```
18
18
 
19
19
  Edit your `_config.yml`:
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.20.0'
3
+ version: '1.22.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
@@ -171,8 +171,8 @@ comments:
171
171
  # Artalk
172
172
  # https://artalk.js.org/
173
173
  artalk:
174
- css: https://unpkg.com/artalk@2.4.3/dist/Artalk.css
175
- js: https://unpkg.com/artalk@2.4.3/dist/Artalk.js
174
+ css: https://unpkg.com/artalk@2.7/dist/Artalk.css
175
+ js: https://unpkg.com/artalk@2.7/dist/Artalk.js
176
176
  server: # 后端服务地址
177
177
  placeholder: ''
178
178
  darkMode: auto
@@ -182,16 +182,16 @@ comments:
182
182
  footer:
183
183
  social:
184
184
  # github:
185
- # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/08a41b181ce68.svg"/>'
185
+ # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/08a41b181ce68.svg"/>'
186
186
  # url: /
187
187
  # music:
188
- # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/3845874.svg"/>'
188
+ # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/3845874.svg"/>'
189
189
  # url: /
190
190
  # unsplash:
191
- # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/3616429.svg"/>'
191
+ # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/3616429.svg"/>'
192
192
  # url: /
193
193
  # comments:
194
- # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/942ebbf1a4b91.svg"/>'
194
+ # icon: '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/942ebbf1a4b91.svg"/>'
195
195
  # url: /about/#comments
196
196
  sitemap:
197
197
  # '博客':
@@ -215,7 +215,7 @@ footer:
215
215
 
216
216
  ######## Tag Plugins ########
217
217
  tag_plugins:
218
- # {% ablock %} / {% note %}
218
+ # {% box %} / {% note %}
219
219
  note:
220
220
  default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
221
221
  border: true # true / false
@@ -272,6 +272,12 @@ tag_plugins:
272
272
  unfinished:
273
273
  color: red
274
274
  label: 未完成
275
+ # {% gallery %}
276
+ gallery:
277
+ layout: grid # grid / flow
278
+ size: mix # s / m / l / xl / mix
279
+ ratio: square # origin / square
280
+
275
281
 
276
282
 
277
283
 
@@ -290,6 +296,7 @@ plugins:
290
296
  linkcard: /js/plugins/linkcard.js
291
297
  fcircle: /js/plugins/fcircle.js
292
298
  weibo: /js/plugins/weibo.js
299
+ memos: /js/plugins/memos.js
293
300
 
294
301
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
295
302
 
@@ -326,13 +333,13 @@ plugins:
326
333
  # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
327
334
  # 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
328
335
  # 使用waline评论可以写: #waline_container .vcontent img
329
- selector: .swiper-slide img # 多个选择器用英文逗号隔开
336
+ selector: .swiper-slide img, .gallery img # 多个选择器用英文逗号隔开
330
337
 
331
338
  # swiper
332
339
  swiper:
333
340
  enable: true
334
- css: https://unpkg.com/swiper@8.4.5/swiper-bundle.min.css
335
- js: https://unpkg.com/swiper@8.4.5/swiper-bundle.min.js
341
+ css: https://unpkg.com/swiper@10.3/swiper-bundle.min.css
342
+ js: https://unpkg.com/swiper@10.3/swiper-bundle.min.js
336
343
 
337
344
 
338
345
  # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
@@ -392,7 +399,7 @@ plugins:
392
399
 
393
400
  style:
394
401
  darkmode: auto # auto / always / false
395
- smooth_scroll: true # true / false
402
+ smooth_scroll: false # true / false 开启时如果目录过长可能无法准确定位
396
403
  font-size:
397
404
  root: 16px
398
405
  body: .9375rem # 15px
@@ -425,7 +432,7 @@ style:
425
432
  underline: true # true / false
426
433
  animated_avatar:
427
434
  animate: auto # auto, always
428
- background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/avatar/round/rainbow64@3x.webp
435
+ background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/rainbow64@3x.webp
429
436
  codeblock:
430
437
  scrollbar: 4px
431
438
  highlightjs_theme: https://gcore.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/atom-one-dark.min.css
@@ -437,10 +444,12 @@ style:
437
444
  search: 'linear-gradient(to right, #04F3FF, #08FFC6, #DDF730, #FFBD19, #FF1FE0, #C418FF, #04F3FF)'
438
445
 
439
446
  default:
440
- avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/avatar/round/3442075.svg
441
- link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/link/8f277b4ee0ecd.svg
442
- cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/cover/76b86c0226ffd.svg
443
- image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/image/2659360.svg
447
+ avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg
448
+ link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/link/8f277b4ee0ecd.svg
449
+ cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/cover/76b86c0226ffd.svg
450
+ image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2659360.svg
451
+ project: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2779789.png
452
+ banner: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/banner/books.jpg
444
453
 
445
454
  api_host:
446
455
  ghapi: https://api.github.com
@@ -23,7 +23,7 @@ meta:
23
23
  related_posts: 您可能感兴趣的文章
24
24
  comment_title: 快来参与讨论吧
25
25
  back_to_top: 回到顶部
26
- more: '更多%s'
26
+ more: '更多「%s'
27
27
  created: 发布于
28
28
  updated: 更新于
29
29
  license: 许可协议
@@ -23,7 +23,7 @@ meta:
23
23
  related_posts: 您可能感興趣的文章
24
24
  comment_title: 參與討論
25
25
  back_to_top: 回到頁首
26
- more: '更多%s'
26
+ more: '更多「%s'
27
27
  created: 發布於
28
28
  updated: 更新於
29
29
  license: 授權條款
package/layout/404.ejs CHANGED
@@ -6,7 +6,7 @@ page.header = 'auto';
6
6
  page.robots = 'none';
7
7
  %>
8
8
  <article class='md-text error-page'>
9
- <h1><img id='error' src='https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/404/1c830bfcd517d.svg' alt='404'></h1>
9
+ <h1><img id='error' src='https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/404/1c830bfcd517d.svg' alt='404'></h1>
10
10
  <p class='what'>
11
11
  <strong>
12
12
  <%- __('page.error.what') %>
@@ -8,34 +8,28 @@ function layoutWikiCover() {
8
8
  if (proj.homepage.path !== page.path) {
9
9
  return;
10
10
  }
11
- if (proj.cover == undefined || proj.cover === false || proj.cover === '[]') {
11
+ if (proj.coverpage == undefined || proj.coverpage === false || proj.coverpage === '[]') {
12
12
  return el;
13
13
  }
14
- var cover = proj.cover;
15
- let logo = proj.logo;
14
+ var coverpage = proj.coverpage;
15
+ let cover = proj.cover;
16
16
  let title = proj.title || page.title;
17
17
  let desc = proj.description || page.description;
18
- if (cover === true) {
19
- cover = ['logo', 'title', 'description'];
18
+ if (coverpage === true) {
19
+ coverpage = ['cover', 'title', 'description'];
20
20
  }
21
21
  el += '<div class="l_cover wiki' + scrollreveal() + '">';
22
22
  el += '<article class="cover-wrap md-text">';
23
23
 
24
- if (logo && logo.src && cover.includes('logo')) {
25
- el += '<div class="preview">';
26
- if (logo.large) {
27
- el += '<img src="' + logo.src + '" height="' + logo.large + '">';
28
- } else {
29
- el += '<img src="' + logo.src + '">';
30
- }
31
- el += '</div>';
24
+ if (cover?.length > 0 && coverpage.includes('cover')) {
25
+ el += `<div class="preview cover"><img src="${cover}"/></div>`
32
26
  }
33
- if (title && cover.includes('title')) {
27
+ if (title && coverpage.includes('title')) {
34
28
  el += '<div class="cover-title">';
35
29
  el += '<span>' + title + '</span>';
36
30
  el += '</div>';
37
31
  }
38
- if (desc && cover.includes('description')) {
32
+ if (desc && coverpage.includes('description')) {
39
33
  el += '<div class="description">' + desc + '</div>';
40
34
  }
41
35
  el += '<div class="start-wrap">';
@@ -65,7 +65,7 @@ function og_args() {
65
65
  if (page.layout == 'post' && page.cover) {
66
66
  args.twitter_card = 'summary_large_image';
67
67
  }
68
- return args;
68
+ return Object.assign(args, page.open_graph);
69
69
  }
70
70
  %>
71
71
  <head>
@@ -18,18 +18,13 @@ function layoutDiv() {
18
18
  if (page.references?.length > 0) {
19
19
  function refList() {
20
20
  var el = '';
21
- page.references.forEach((item, i) => {
22
- el += '<li class="post-title">';
23
- el += '<a href="' + item.url + '"';
24
- if (item.url.includes('://')) {
25
- el += ' target="_blank" rel="external nofollow noopener noreferrer">';
26
- } else {
27
- el += ' rel="noopener noreferrer">';
28
- }
29
- el += item.title || item.url;
30
- el += '</a>';
31
- el += '</li>';
32
- });
21
+ for (let ref of page.references) {
22
+ el += `
23
+ <li class="post-title">
24
+ ${markdown(ref)}
25
+ </li>
26
+ `
27
+ }
33
28
  return el;
34
29
  }
35
30
  el += `
@@ -108,13 +103,13 @@ function layoutDiv() {
108
103
  }
109
104
  el += '>';
110
105
  if (item == 'wechat') {
111
- el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/b32ef3da1162a.svg"/>';
106
+ el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/b32ef3da1162a.svg"/>';
112
107
  } else if (item == 'weibo') {
113
- el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/80c07e4dbb303.svg"/>';
108
+ el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/80c07e4dbb303.svg"/>';
114
109
  } else if (item == 'email') {
115
- el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/a1b00e20f425d.svg"/>';
110
+ el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/a1b00e20f425d.svg"/>';
116
111
  } else if (item == 'link') {
117
- el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/8411ed322ced6.svg"/>';
112
+ el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/social/8411ed322ced6.svg"/>';
118
113
  }
119
114
  el += '</a>';
120
115
  }
@@ -22,9 +22,9 @@ function layoutDiv() {
22
22
  el += '<div class="bread-nav fs12">';
23
23
  el += '<div class="left">';
24
24
  el += '<div id="breadcrumb">';
25
- el += '<a class="cap breadcrumb" href="' + config.root + '">' + home_title + '</a>';
25
+ el += '<a class="cap breadcrumb" href="' + url_for(config.root) + '">' + home_title + '</a>';
26
26
  el += '<span class="sep"></span>';
27
- el += '<a class="cap breadcrumb" href="' + config.index_generator.path + '">' + __("btn.blog") + '</a>';
27
+ el += '<a class="cap breadcrumb" href="' + url_for(config.index_generator.path) + '">' + __("btn.blog") + '</a>';
28
28
  if (page.layout == "post" && page.categories && page.categories.length > 0) {
29
29
  el += '<span class="sep"></span>';
30
30
  el += list_categories(page.categories, {
@@ -53,7 +53,7 @@ function layoutDiv() {
53
53
  el += '<div id="breadcrumb">';
54
54
  var nodes = [];
55
55
  // home
56
- el += '<a class="cap breadcrumb" id="home" href="' + config.root + '">' + home_title + '</a>';
56
+ el += '<a class="cap breadcrumb" id="home" href="' + url_for(config.root) + '">' + home_title + '</a>';
57
57
  nodes.push('/');
58
58
  // menu_id
59
59
  el += '<span class="sep"></span>';
@@ -109,7 +109,7 @@ function layoutDiv() {
109
109
  <div class="bread-nav fs12">
110
110
  <div class="left">
111
111
  <div id="breadcrumb">
112
- <a class="cap breadcrumb" href="${config.root}">${home_title}</a>
112
+ <a class="cap breadcrumb" href="${url_for(config.root)}">${home_title}</a>
113
113
  <span class="sep"></span>
114
114
  <a class="cap breadcrumb" href="${url_for(page.path)}">${page.title || page.seo_title}</a>
115
115
  </div>
@@ -90,7 +90,7 @@ function div_default() {
90
90
  }
91
91
  }
92
92
  if (post.pin) {
93
- el += '<span class="pin"><img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/badge/3279dd441df8b.svg"/></span>';
93
+ el += '<span class="pin"><img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/badge/3279dd441df8b.svg"/></span>';
94
94
  }
95
95
  el += '</div>';
96
96
  el += '</article>';
@@ -2,19 +2,14 @@
2
2
  function layoutDiv() {
3
3
  var el = '';
4
4
  el += '<article class="md-text">';
5
- if (proj.logo && proj.logo.src) {
6
- el += '<div class="preview">';
7
- el += '<img src="' + proj.logo.src + '" alt="logo"';
8
- if (proj.logo.small) {
9
- el += ' height="' + proj.logo.small + '"';
10
- }
11
- el += '/>';
12
- el += '</div>';
13
- }
5
+ el += `<div class="preview"><img src="${proj.icon ? proj.icon : theme.default.project}"/></div>`
14
6
  el += '<div class="excerpt">';
15
7
  if (proj.tags && proj.tags.length > 0) {
16
- let tag = proj.tags[0];
17
- el += '<div class="cap breadcrumb"' + category_color(tag) + '>' + tag + '</div>';
8
+ el += '<div class="caps">';
9
+ for (let tag of proj.tags) {
10
+ el += '<span class="cap breadcrumb"' + category_color(tag) + '>' + tag + '</span>';
11
+ }
12
+ el += '</div>';
18
13
  }
19
14
  el += '<h2 class="post-title">' + (proj.title || proj.name) + '</h2>';
20
15
  if (proj.description) {
@@ -8,7 +8,7 @@
8
8
  if (!path) {
9
9
  path = decodeURI(window.location.pathname);
10
10
  }
11
- var artalk = new Artalk({
11
+ var artalk = Artalk.init({
12
12
  el: '#artalk_container',
13
13
  pageKey: path,
14
14
  pageTitle: '<%= page.title || page.seo_title %>',
@@ -56,7 +56,7 @@ function layoutWidgets() {
56
56
  el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
57
57
  // all products
58
58
  el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(config.wiki_dir) + '">';
59
- el += '<svg aria-hidden="true" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
59
+ el += '<svg aria-hidden="true" viewBox="0 0 16 16" width="1.2em" height="1.2em" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
60
60
  el += __('btn.all_wiki');
61
61
  el += '</a>';
62
62
  // this product
@@ -42,7 +42,7 @@ function layoutDiv() {
42
42
  el += '</div>';
43
43
  // follow
44
44
  el += '<a class="follow" href="https://github.com/' + item.username + '">';
45
- el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
45
+ el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
46
46
  el += 'Follow';
47
47
  el += '</a>';
48
48
  // menu
@@ -3,34 +3,25 @@ function layoutDiv() {
3
3
  if (page.layout !== "wiki") {
4
4
  return '';
5
5
  }
6
- var related = [];
7
- const { shelf, tree } = theme.wiki;
8
- let proj = tree[page.wiki];
9
- if (proj?.related?.length > 0) {
10
- proj.related.filter(pid => shelf.includes(pid)).forEach((pid, i) => {
11
- let p = tree[pid];
12
- if (p && p.title !== proj?.title && p.homepage) {
13
- related.push(p);
14
- }
15
- });
6
+ let thisItemObject = theme.wiki.tree[page.wiki];
7
+ if (thisItemObject == null) {
8
+ return '';
16
9
  }
10
+ const relatedItems = thisItemObject.relatedItems;
17
11
  var el = '';
18
- if (related.length > 0) {
12
+ for (let relatedItem of relatedItems) {
19
13
  el += '<widget class="widget-wrapper related">';
20
14
  el += '<div class="widget-header cap theme dis-select">';
21
- var title = __('btn.wiki');
22
- if (proj.tags && proj.tags[0]) {
23
- title = proj.tags[0];
24
- }
25
- el += '<span class="name">' + __('meta.more', title) + '</span>';
15
+ el += '<span class="name">' + __('meta.more', relatedItem.name) + '</span>';
26
16
  el += '</div>';
27
17
  el += '<div class="widget-body related-posts">';
28
- for (let p of related) {
18
+ for (let id of relatedItem.items) {
29
19
  // 同一个分组中的其它项目
30
- el += '<a class="item wiki" href="' + url_for(p.homepage?.path) + '">';
31
- el += '<span class="title">' + p.title + '</span>';
32
- if (p.description && p.description.length > 0) {
33
- el += '<span class="excerpt">' + p.description + '</span>';
20
+ let item = theme.wiki.tree[id];
21
+ el += '<a class="item wiki" href="' + url_for(item.homepage?.path) + '">';
22
+ el += '<span class="title">' + item.title + '</span>';
23
+ if (item.description && item.description.length > 0) {
24
+ el += '<span class="excerpt">' + item.description + '</span>';
34
25
  }
35
26
  el += '</a>';
36
27
  }
@@ -78,14 +78,17 @@ function layoutDiv(fallback) {
78
78
  } else if (proj) {
79
79
  // wiki 布局
80
80
  if (proj.sections && proj.sections.length > 0 && proj.pages.length > 1) { // 多 pages
81
- proj.sections.forEach((sec, i) => {
81
+ for (let sec of proj.sections) {
82
+ if (sec.pages.length == 0) {
83
+ continue;
84
+ }
82
85
  if (sec.title?.length > 0) {
83
86
  el += layoutTocHeader(sec.title);
84
87
  }
85
88
  el += '<div class="widget-body fs14">';
86
89
  el += layoutDocTree(sec.pages);
87
90
  el += '</div>';
88
- });
91
+ }
89
92
  } else { // 单 page
90
93
  if (proj.pages.length == 1) {
91
94
  el += layoutTocHeader(page.toc_title);
package/layout/index.ejs CHANGED
@@ -22,7 +22,7 @@ function layout_post_card(layout, post, content) {
22
22
  return el;
23
23
  }
24
24
 
25
- function layout_posts(partial) {
25
+ function layout_post_list(partial) {
26
26
  var el = '';
27
27
  el += '<div class="post-list post">';
28
28
  if (is_home()) {
@@ -48,9 +48,8 @@ function layout_posts(partial) {
48
48
  return el;
49
49
  }
50
50
 
51
- function layout_wikis(partial) {
51
+ function layout_wiki_list(partial) {
52
52
  var el = '';
53
- var wikis = [];
54
53
  const { shelf, tree } = theme.wiki;
55
54
  for (let pid of shelf) {
56
55
  let proj = tree[pid];
@@ -61,12 +60,12 @@ function layout_wikis(partial) {
61
60
  continue;
62
61
  }
63
62
  if (page.filter === false) {
64
- // all wikis
63
+ // wikiList
65
64
  el += '<div class="post-list wiki">';
66
65
  el += layout_post_card('wiki', proj.homepage, partial(proj));
67
66
  el += '</div>';
68
67
  } else if (proj.tags && proj.tags.includes(page.tagName) === true) {
69
- // filtered wikis
68
+ // filtered wikiList
70
69
  el += '<div class="post-list wiki filter">';
71
70
  el += layout_post_card('wiki', proj.homepage, partial(proj));
72
71
  el += '</div>';
@@ -78,13 +77,13 @@ function layout_wikis(partial) {
78
77
 
79
78
  <% if (page.menu_id === 'post') { %>
80
79
  <%- partial('_partial/main/navbar/list_post') %>
81
- <%- layout_posts(function(post){
80
+ <%- layout_post_list(function(post){
82
81
  return partial('_partial/main/post_list/post_card', {post: post})
83
82
  }) %>
84
83
  <%- partial('_partial/main/post_list/paginator') %>
85
84
  <% } else if (page.menu_id === 'wiki') { %>
86
85
  <%- partial('_partial/main/navbar/list_wiki') %>
87
- <%- layout_wikis(function(proj){
86
+ <%- layout_wiki_list(function(proj){
88
87
  return partial('_partial/main/post_list/wiki_card', {proj: proj})
89
88
  }) %>
90
89
  <% } %>
package/layout/post.ejs CHANGED
@@ -30,7 +30,7 @@ if (theme.plugins.heti && theme.plugins.heti.enable) {
30
30
  <%- layoutTitle() %>
31
31
  <%- post.content %>
32
32
  <% if (theme.plugins.tianli_gpt.enable && ['all', 'post'].includes(theme.plugins.tianli_gpt.field)) { %>
33
- <%- partial('_partial/main/article/ai_abstract') %>
33
+ <%- partial('_partial/plugins/ai/tianli_gpt') %>
34
34
  <% } %>
35
35
  <%- partial('_partial/main/article/article_footer') %>
36
36
  </article>
package/layout/wiki.ejs CHANGED
@@ -37,7 +37,7 @@ function layoutTitle() {
37
37
  <%- layoutTitle() %>
38
38
  <%- page.content %>
39
39
  <% if (theme.plugins.tianli_gpt.enable && ['all', 'wiki'].includes(theme.plugins.tianli_gpt.field)) { %>
40
- <%- partial('_partial/main/article/ai_abstract') %>
40
+ <%- partial('_partial/plugins/ai/tianli_gpt') %>
41
41
  <% } %>
42
42
  <%- partial('_partial/main/article/article_footer') %>
43
43
  </article>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -58,7 +58,9 @@ module.exports = ctx => {
58
58
  // wiki 所有页面
59
59
  const wiki_pages = pages.filter(p => (p.layout === 'wiki')).map(p => new WikiPage(p))
60
60
  const wiki_list = Object.keys(wiki.tree)
61
-
61
+ // 上架的项目列表
62
+ wiki.shelf = ctx.locals.get('data').wiki
63
+
62
64
  // 数据整合:项目标签
63
65
  var all_tag_name = []
64
66
  for (let id of wiki_list) {
@@ -158,17 +160,25 @@ module.exports = ctx => {
158
160
  // 全站所有的项目标签
159
161
  var all_tags = {}
160
162
  all_tag_name.forEach((tag_name, i) => {
161
- var subs = []
163
+ var items = []
162
164
  for (let id of wiki_list) {
163
165
  let item = wiki.tree[id]
164
- if (item.tags && item.tags.includes(tag_name) === true && subs.includes(tag_name) === false) {
165
- subs.push(item.id)
166
+ // 过滤掉找不到页面的项目
167
+ if (item.homepage == null) {
168
+ continue
169
+ }
170
+ // 过滤掉未上架的项目
171
+ if (!wiki.shelf.includes(item.id)) {
172
+ continue
173
+ }
174
+ if (item.tags && item.tags.includes(tag_name) === true && items.includes(tag_name) === false) {
175
+ items.push(item.id)
166
176
  }
167
177
  }
168
178
  all_tags[tag_name] = {
169
179
  name: tag_name,
170
180
  path: (ctx.config.wiki_dir || 'wiki') + '/tags/' + tag_name + '/index.html',
171
- items: subs
181
+ items: items
172
182
  }
173
183
  })
174
184
 
@@ -176,13 +186,17 @@ module.exports = ctx => {
176
186
  for (let id of wiki_list) {
177
187
  let item = wiki.tree[id]
178
188
  if (item.tags) {
179
- var related = []
189
+ var relatedItems = []
180
190
  item.tags.forEach((tag_name, i) => {
181
- let tagObj = all_tags[tag_name]
182
- related = related.concat(tagObj.items)
183
- related = [...new Set(related)]
191
+ let relatedOtherItems = all_tags[tag_name].items.filter(name => name != item.id)
192
+ if (relatedOtherItems.length > 0) {
193
+ relatedItems.push({
194
+ name: tag_name,
195
+ items: relatedOtherItems
196
+ })
197
+ }
184
198
  })
185
- item.related = related
199
+ item.relatedItems = relatedItems
186
200
  }
187
201
  }
188
202
 
@@ -1,9 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  hexo.extend.helper.register('category_color', function(cat){
4
- const cfg = hexo.theme.config;
5
- if (cfg.article.category_color && cfg.article.category_color[cat]) {
6
- return ' style="color:' + cfg.article.category_color[cat] + '"';
4
+ const { config } = hexo.theme
5
+ const color = config.article.category_color[cat]
6
+ if (color) {
7
+ var textColor = color
8
+ if (color.startsWith('#')) {
9
+ textColor = color
10
+ } else {
11
+ textColor = '#' + color
12
+ }
13
+ var bgColor = textColor
14
+ if (textColor.length == (1+3)) { // #fff
15
+ bgColor += '2'
16
+ } else if (textColor.length == (1+6)) { // #ffffff
17
+ bgColor += '20'
18
+ }
19
+ return ` style="--text-p3:${textColor};--theme-block:${bgColor}"`;
7
20
  }
8
- return '';
9
- });
21
+ return ''
22
+ })
@@ -4,12 +4,14 @@
4
4
 
5
5
  // container
6
6
  hexo.extend.tag.register('tabs', require('./lib/tabs')(hexo), true)
7
- hexo.extend.tag.register('ablock', require('./lib/ablock')(hexo), true)
7
+ hexo.extend.tag.register('box', require('./lib/box')(hexo), true)
8
8
  hexo.extend.tag.register('about', require('./lib/about')(hexo), true)
9
9
  hexo.extend.tag.register('folding', require('./lib/folding')(hexo), true)
10
10
  hexo.extend.tag.register('folders', require('./lib/folders')(hexo), true)
11
11
  hexo.extend.tag.register('grid', require('./lib/grid')(hexo), true)
12
12
  hexo.extend.tag.register('swiper', require('./lib/swiper')(hexo), true)
13
+ hexo.extend.tag.register('gallery', require('./lib/gallery')(hexo), {ends: true})
14
+ hexo.extend.tag.register('banner', require('./lib/banner')(hexo), true)
13
15
 
14
16
  // data
15
17
  hexo.extend.tag.register('users', require('./lib/friends')(hexo))