hexo-theme-stellar 1.20.0 → 1.21.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.
- package/README.md +3 -3
- package/_config.yml +18 -15
- package/languages/zh-CN.yml +1 -1
- package/languages/zh-TW.yml +1 -1
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +9 -15
- package/layout/_partial/head.ejs +1 -1
- package/layout/_partial/main/article/article_footer.ejs +11 -16
- package/layout/_partial/main/navbar/breadcrumb.ejs +4 -4
- package/layout/_partial/main/post_list/post_card.ejs +1 -1
- package/layout/_partial/main/post_list/wiki_card.ejs +6 -11
- package/layout/_partial/sidebar/index.ejs +1 -1
- package/layout/_partial/widgets/ghuser.ejs +1 -1
- package/layout/_partial/widgets/related.ejs +12 -21
- package/layout/_partial/widgets/toc.ejs +5 -2
- package/layout/index.ejs +6 -7
- package/layout/post.ejs +1 -1
- package/layout/wiki.ejs +1 -1
- package/package.json +1 -1
- package/scripts/events/lib/doc_tree.js +24 -10
- package/scripts/helpers/category_color.js +18 -5
- package/scripts/tags/index.js +3 -1
- package/scripts/tags/lib/banner.js +68 -0
- package/scripts/tags/lib/{ablock.js → box.js} +3 -3
- package/scripts/tags/lib/gallery.js +51 -0
- package/scripts/tags/lib/navbar.js +15 -34
- package/scripts/tags/lib/swiper.js +1 -1
- package/scripts/tags/lib/timeline.js +3 -3
- package/source/css/_common/highlight.styl +1 -0
- package/source/css/_layout/list.styl +12 -4
- package/source/css/_layout/md.styl +1 -1
- package/source/css/_layout/partial/cover.styl +2 -0
- package/source/css/_layout/partial/paginator.styl +2 -2
- package/source/css/_layout/tag-plugins/banner.styl +106 -0
- package/source/css/_layout/tag-plugins/common.styl +5 -2
- package/source/css/_layout/tag-plugins/frame.styl +1 -1
- package/source/css/_layout/tag-plugins/gallery.styl +46 -0
- package/source/css/_layout/tag-plugins/grid.styl +0 -9
- package/source/css/_layout/tag-plugins/note.styl +1 -0
- package/source/css/_layout/tag-plugins/timeline.styl +14 -1
- package/source/css/_layout/widgets/ghuser.styl +5 -6
- package/source/css/_plugins/copycode.styl +17 -6
- package/source/css/_plugins/fancybox.styl +4 -0
- package/source/css/_plugins/index.styl +2 -0
- package/source/css/{_layout/partial/ai_abstract.styl → _plugins/tianli_gpt.styl} +2 -2
- package/source/js/main.js +24 -2
- package/source/js/plugins/copycode.js +0 -4
- package/source/js/plugins/fcircle.js +3 -3
- package/source/js/plugins/friends.js +3 -3
- package/source/js/plugins/memos.js +133 -0
- package/source/js/plugins/sites.js +4 -4
- package/source/js/plugins/timeline.js +3 -3
- package/source/js/plugins/weibo.js +3 -3
- /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:
|
|
13
|
+
Hexo: 6.3.0 ~ 7.0.0
|
|
14
14
|
hexo-cli: 4.3.0 ~ latest
|
|
15
|
-
node
|
|
16
|
-
npm: 6.14.13 ~
|
|
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.
|
|
3
|
+
version: '1.21.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
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
# {%
|
|
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
|
|
@@ -290,6 +290,7 @@ plugins:
|
|
|
290
290
|
linkcard: /js/plugins/linkcard.js
|
|
291
291
|
fcircle: /js/plugins/fcircle.js
|
|
292
292
|
weibo: /js/plugins/weibo.js
|
|
293
|
+
memos: /js/plugins/memos.js
|
|
293
294
|
|
|
294
295
|
marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
|
|
295
296
|
|
|
@@ -326,13 +327,13 @@ plugins:
|
|
|
326
327
|
# 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
|
|
327
328
|
# 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
|
|
328
329
|
# 使用waline评论可以写: #waline_container .vcontent img
|
|
329
|
-
selector: .swiper-slide img # 多个选择器用英文逗号隔开
|
|
330
|
+
selector: .swiper-slide img, .gallery img # 多个选择器用英文逗号隔开
|
|
330
331
|
|
|
331
332
|
# swiper
|
|
332
333
|
swiper:
|
|
333
334
|
enable: true
|
|
334
|
-
css: https://unpkg.com/swiper@
|
|
335
|
-
js: https://unpkg.com/swiper@
|
|
335
|
+
css: https://unpkg.com/swiper@10.3/swiper-bundle.min.css
|
|
336
|
+
js: https://unpkg.com/swiper@10.3/swiper-bundle.min.js
|
|
336
337
|
|
|
337
338
|
|
|
338
339
|
# 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
|
|
@@ -392,7 +393,7 @@ plugins:
|
|
|
392
393
|
|
|
393
394
|
style:
|
|
394
395
|
darkmode: auto # auto / always / false
|
|
395
|
-
smooth_scroll:
|
|
396
|
+
smooth_scroll: false # true / false 开启时如果目录过长可能无法准确定位
|
|
396
397
|
font-size:
|
|
397
398
|
root: 16px
|
|
398
399
|
body: .9375rem # 15px
|
|
@@ -425,7 +426,7 @@ style:
|
|
|
425
426
|
underline: true # true / false
|
|
426
427
|
animated_avatar:
|
|
427
428
|
animate: auto # auto, always
|
|
428
|
-
background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.
|
|
429
|
+
background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/rainbow64@3x.webp
|
|
429
430
|
codeblock:
|
|
430
431
|
scrollbar: 4px
|
|
431
432
|
highlightjs_theme: https://gcore.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/atom-one-dark.min.css
|
|
@@ -437,10 +438,12 @@ style:
|
|
|
437
438
|
search: 'linear-gradient(to right, #04F3FF, #08FFC6, #DDF730, #FFBD19, #FF1FE0, #C418FF, #04F3FF)'
|
|
438
439
|
|
|
439
440
|
default:
|
|
440
|
-
avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.
|
|
441
|
-
link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.
|
|
442
|
-
cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.
|
|
443
|
-
image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.
|
|
441
|
+
avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg
|
|
442
|
+
link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/link/8f277b4ee0ecd.svg
|
|
443
|
+
cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/cover/76b86c0226ffd.svg
|
|
444
|
+
image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2659360.svg
|
|
445
|
+
project: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2779789.png
|
|
446
|
+
banner: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/banner/books.jpg
|
|
444
447
|
|
|
445
448
|
api_host:
|
|
446
449
|
ghapi: https://api.github.com
|
package/languages/zh-CN.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
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.
|
|
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.
|
|
11
|
+
if (proj.coverpage == undefined || proj.coverpage === false || proj.coverpage === '[]') {
|
|
12
12
|
return el;
|
|
13
13
|
}
|
|
14
|
-
var
|
|
15
|
-
let
|
|
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 (
|
|
19
|
-
|
|
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 (
|
|
25
|
-
el +=
|
|
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 &&
|
|
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 &&
|
|
32
|
+
if (desc && coverpage.includes('description')) {
|
|
39
33
|
el += '<div class="description">' + desc + '</div>';
|
|
40
34
|
}
|
|
41
35
|
el += '<div class="start-wrap">';
|
package/layout/_partial/head.ejs
CHANGED
|
@@ -18,18 +18,13 @@ function layoutDiv() {
|
|
|
18
18
|
if (page.references?.length > 0) {
|
|
19
19
|
function refList() {
|
|
20
20
|
var el = '';
|
|
21
|
-
page.references
|
|
22
|
-
el +=
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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) {
|
|
@@ -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="
|
|
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="
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
18
|
+
for (let id of relatedItem.items) {
|
|
29
19
|
// 同一个分组中的其它项目
|
|
30
|
-
|
|
31
|
-
el += '<
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
-
<%-
|
|
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
|
-
<%-
|
|
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/
|
|
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/
|
|
40
|
+
<%- partial('_partial/plugins/ai/tianli_gpt') %>
|
|
41
41
|
<% } %>
|
|
42
42
|
<%- partial('_partial/main/article/article_footer') %>
|
|
43
43
|
</article>
|
package/package.json
CHANGED
|
@@ -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
|
|
163
|
+
var items = []
|
|
162
164
|
for (let id of wiki_list) {
|
|
163
165
|
let item = wiki.tree[id]
|
|
164
|
-
|
|
165
|
-
|
|
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:
|
|
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
|
|
189
|
+
var relatedItems = []
|
|
180
190
|
item.tags.forEach((tag_name, i) => {
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
|
|
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.
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
})
|
package/scripts/tags/index.js
CHANGED
|
@@ -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('
|
|
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))
|