hexo-theme-stellar 1.25.0 → 1.26.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 (117) hide show
  1. package/_config.yml +80 -32
  2. package/_data/icons.yml +33 -0
  3. package/_data/widgets.yml +2 -16
  4. package/languages/zh-CN.yml +1 -1
  5. package/languages/zh-TW.yml +1 -1
  6. package/layout/404.ejs +2 -2
  7. package/layout/_partial/cover/index.ejs +5 -5
  8. package/layout/_partial/cover/post_cover.ejs +1 -1
  9. package/layout/_partial/cover/wiki_cover.ejs +2 -2
  10. package/layout/_partial/head.ejs +5 -8
  11. package/layout/_partial/main/article/article_footer.ejs +7 -15
  12. package/layout/_partial/main/article/read_next.ejs +6 -6
  13. package/layout/_partial/main/article/related_posts.ejs +1 -1
  14. package/layout/_partial/main/footer.ejs +1 -1
  15. package/layout/_partial/main/navbar/article_top_area.ejs +35 -0
  16. package/layout/_partial/main/navbar/author_banner.ejs +1 -3
  17. package/layout/_partial/main/navbar/breadcrumb/blog.ejs +34 -0
  18. package/layout/_partial/main/navbar/breadcrumb/page.ejs +10 -0
  19. package/layout/_partial/main/navbar/breadcrumb/wiki.ejs +20 -0
  20. package/layout/_partial/main/navbar/dateinfo.ejs +32 -0
  21. package/layout/_partial/main/navbar/ghinfo.ejs +25 -0
  22. package/layout/_partial/main/navbar/nav_tabs_blog.ejs +3 -3
  23. package/layout/_partial/main/navbar/nav_tabs_wiki.ejs +2 -2
  24. package/layout/_partial/main/post_list/paginator.ejs +1 -1
  25. package/layout/_partial/main/post_list/post_card.ejs +3 -3
  26. package/layout/_partial/menubtn.ejs +1 -1
  27. package/layout/_partial/plugins/ai/tianli_gpt.ejs +4 -3
  28. package/layout/_partial/plugins/comments/artalk/layout.ejs +1 -1
  29. package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
  30. package/layout/_partial/plugins/comments/beaudar/layout.ejs +1 -1
  31. package/layout/_partial/plugins/comments/giscus/layout.ejs +1 -1
  32. package/layout/_partial/plugins/comments/layout.ejs +3 -3
  33. package/layout/_partial/plugins/comments/twikoo/layout.ejs +1 -1
  34. package/layout/_partial/plugins/comments/utterances/layout.ejs +1 -1
  35. package/layout/_partial/plugins/comments/waline/layout.ejs +1 -1
  36. package/layout/_partial/sidebar/index.ejs +72 -71
  37. package/layout/_partial/sidebar/logo.ejs +87 -0
  38. package/layout/_partial/sidebar/menu.ejs +23 -18
  39. package/layout/_partial/sidebar/search.ejs +42 -0
  40. package/layout/_partial/widgets/components/link.ejs +21 -0
  41. package/layout/_partial/widgets/components/linklist.ejs +27 -0
  42. package/layout/_partial/widgets/ghissues.ejs +7 -9
  43. package/layout/_partial/widgets/ghrepo.ejs +10 -12
  44. package/layout/_partial/widgets/ghuser.ejs +2 -6
  45. package/layout/_partial/widgets/linklist.ejs +17 -0
  46. package/layout/_partial/widgets/markdown.ejs +5 -2
  47. package/layout/_partial/widgets/recent.ejs +12 -8
  48. package/layout/_partial/widgets/related.ejs +13 -9
  49. package/layout/_partial/widgets/search.ejs +0 -40
  50. package/layout/_partial/widgets/tagcloud.ejs +2 -2
  51. package/layout/_partial/widgets/timeline.ejs +2 -2
  52. package/layout/_partial/widgets/toc.ejs +24 -24
  53. package/layout/archive.ejs +2 -2
  54. package/layout/categories.ejs +1 -1
  55. package/layout/index.ejs +4 -20
  56. package/layout/index_topic.ejs +1 -1
  57. package/layout/index_wiki.ejs +2 -2
  58. package/layout/layout.ejs +53 -21
  59. package/layout/page.ejs +59 -12
  60. package/layout/tags.ejs +1 -1
  61. package/package.json +2 -2
  62. package/scripts/events/lib/config.js +28 -24
  63. package/scripts/events/lib/doc_tree.js +27 -19
  64. package/scripts/events/lib/merge_posts.js +0 -1
  65. package/scripts/generators/topic.js +3 -3
  66. package/scripts/generators/wiki.js +5 -4
  67. package/scripts/helpers/category_color.js +1 -1
  68. package/scripts/helpers/icon.js +16 -0
  69. package/scripts/helpers/parse_config.js +18 -16
  70. package/scripts/helpers/scrollreveal.js +6 -6
  71. package/scripts/tags/lib/toc.js +1 -1
  72. package/source/css/_common/blur.styl +1 -8
  73. package/source/css/_common/cap.styl +1 -1
  74. package/source/css/_common/device.styl +2 -2
  75. package/source/css/_common/highlight.styl +2 -2
  76. package/source/css/_common/layout.styl +6 -0
  77. package/source/css/_common/svg.styl +3 -0
  78. package/source/css/_custom.styl +9 -2
  79. package/source/css/_defines/theme.styl +10 -0
  80. package/source/css/_layout/layout.styl +17 -4
  81. package/source/css/_layout/list.styl +5 -2
  82. package/source/css/_layout/main.styl +5 -4
  83. package/source/css/_layout/md.styl +12 -11
  84. package/source/css/_layout/partial/paginator.styl +2 -2
  85. package/source/css/_layout/sidebar/footer.styl +4 -31
  86. package/source/css/_layout/sidebar/{header.styl → logo.styl} +11 -41
  87. package/source/css/_layout/sidebar/menu.styl +53 -0
  88. package/source/css/_layout/sidebar/nav-area.styl +2 -0
  89. package/source/css/_layout/{widgets → sidebar}/search.styl +51 -50
  90. package/source/css/_layout/sidebar/sidebar.styl +21 -31
  91. package/source/css/_layout/tag-plugins/banner.styl +9 -10
  92. package/source/css/_layout/tag-plugins/okr.styl +0 -1
  93. package/source/css/_layout/tag-plugins/tabs.styl +2 -2
  94. package/source/css/_layout/tag-plugins/toc.styl +1 -1
  95. package/source/css/_layout/widgets/components.styl +49 -0
  96. package/source/css/_layout/widgets/ghrepo.styl +0 -1
  97. package/source/css/_layout/widgets/ghuser.styl +0 -23
  98. package/source/css/_layout/widgets/list.styl +28 -0
  99. package/source/css/_layout/widgets/markdown.styl +20 -0
  100. package/source/css/_layout/widgets/related.styl +36 -5
  101. package/source/css/_layout/widgets/timeline.styl +21 -2
  102. package/source/css/_layout/widgets/toc_blog.styl +1 -1
  103. package/source/css/_layout/widgets/toc_common.styl +12 -12
  104. package/source/css/_layout/widgets/toc_wiki.styl +38 -25
  105. package/source/css/_layout/widgets/widgets.styl +25 -20
  106. package/source/css/_plugins/comments/twikoo.styl +9 -9
  107. package/source/css/_plugins/scrollreveal.styl +1 -1
  108. package/source/css/_plugins/tianli_gpt.styl +12 -14
  109. package/source/js/main.js +5 -2
  110. package/source/js/plugins/copycode.js +3 -3
  111. package/layout/_partial/main/header/index.ejs +0 -3
  112. package/layout/_partial/main/navbar/breadcrumb.ejs +0 -161
  113. package/layout/_partial/sidebar/header.ejs +0 -58
  114. package/layout/post.ejs +0 -33
  115. package/layout/topic.ejs +0 -28
  116. package/layout/wiki.ejs +0 -32
  117. package/source/css/_layout/widgets/recent.styl +0 -15
@@ -0,0 +1,21 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = ''
4
+ const isActive = url_for(item.url) == url_for(page.path)
5
+ el += `<a class="link${isActive ? ' active' : ''}" title="${item.title}" href="${item.url}">`
6
+ el += `<div class="flex">`
7
+ if (item.icon) {
8
+ el += icon(item.icon)
9
+ }
10
+ if (columns <= 2) {
11
+ el += `<span>${item.title}</span>`
12
+ }
13
+ el += `</div>`
14
+ if (columns == 1 && isActive) {
15
+ el += icon('default:bookmark.active')
16
+ }
17
+ el += `</a>`
18
+ return el
19
+ }
20
+ %>
21
+ <%- layoutDiv() %>
@@ -0,0 +1,27 @@
1
+ <%
2
+ function layoutDiv(linklist) {
3
+ var links = linklist.items || []
4
+ if (links.length == 0) {
5
+ return ''
6
+ }
7
+ var el = ''
8
+ var style = ''
9
+ var columns = linklist.columns || links.length
10
+ if (links.length == 1) {
11
+ style += `style="grid-template-columns:repeat(1,1fr);"`
12
+ } else {
13
+ style += `style="grid-template-columns:repeat(${columns},1fr);"`
14
+ }
15
+ var align = 'center'
16
+ if (columns == 1 && links.length > 1) {
17
+ align = 'left'
18
+ }
19
+ el += `<div class="linklist ${align}" ${style}>`
20
+ for (let link of links) {
21
+ el += partial('link', {item: link, columns: columns})
22
+ }
23
+ el += `</div>`
24
+ return el
25
+ }
26
+ %>
27
+ <%- layoutDiv(item) %>
@@ -5,13 +5,11 @@ function layoutDiv() {
5
5
  var branch = 'main';
6
6
  if (page.repo) {
7
7
  repo = page.repo
8
- } else if (page.layout === 'wiki' && page.wiki) {
9
- let proj = theme.wiki.tree[page.wiki];
10
- if (proj && proj.repo) {
11
- repo = proj.repo;
12
- if (proj.branch != undefined) {
13
- branch = proj.branch;
14
- }
8
+ } else if (theme.wiki.tree[page.wiki]?.repo) {
9
+ const proj = theme.wiki.tree[page.wiki]
10
+ repo = proj.repo
11
+ if (proj.branch != undefined) {
12
+ branch = proj.branch
15
13
  }
16
14
  }
17
15
  if (repo == undefined) {
@@ -21,9 +19,9 @@ function layoutDiv() {
21
19
  if (item.labels) {
22
20
  item.api += '&labels=' + item.labels;
23
21
  }
24
- el += '<widget class="widget-wrapper timeline">';
22
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
25
23
  if (item.title) {
26
- el += '<div class="widget-header cap theme dis-select">';
24
+ el += '<div class="widget-header dis-select">';
27
25
  el += '<span class="name">' + item.title + '</span>';
28
26
  el += '</div>';
29
27
  }
@@ -5,40 +5,38 @@ function layoutDiv() {
5
5
  var branch = 'main';
6
6
  if (page.repo) {
7
7
  repo = page.repo
8
- } else if (page.layout === 'wiki' && page.wiki) {
9
- let proj = theme.wiki.tree[page.wiki];
10
- if (proj && proj.repo) {
11
- repo = proj.repo;
12
- if (proj.branch != undefined) {
13
- branch = proj.branch;
14
- }
8
+ } else if (theme.wiki.tree[page.wiki]?.repo) {
9
+ const proj = theme.wiki.tree[page.wiki]
10
+ repo = proj.repo
11
+ if (proj.branch != undefined) {
12
+ branch = proj.branch
15
13
  }
16
14
  }
17
15
  if (repo == undefined) {
18
16
  return el;
19
17
  }
20
18
  // 布局
21
- el += '<widget class="widget-wrapper ghrepo">';
19
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} ghrepo">`
22
20
  // body
23
21
  el += '<div class="widget-body">';
24
22
  el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
25
23
  el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
26
24
  el += '<div class="repo-name flex-row">';
27
- el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>';
25
+ el += icon('github:repo')
28
26
  el += repo;
29
27
  el += '</div>';
30
28
  el += '<div class="repo-desc"><span type="text" id="description">&nbsp;</span></div>';
31
29
  el += '<div class="grid">';
32
30
  el += '<div class="flex-row">';
33
- el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>';
31
+ el += icon('github:star')
34
32
  el += '<span type="text" id="stargazers_count"></span>';
35
33
  el += '</div>';
36
34
  el += '<div class="flex-row">';
37
- el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>';
35
+ el += icon('github:fork')
38
36
  el += '<span type="text" id="forks_count"></span>';
39
37
  el += '</div>';
40
38
  el += '<div class="flex-row stellar-ghinfo-api" index="0" api="' + theme.api_host.ghapi + '/repos/' + repo + '/tags">';
41
- el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>';
39
+ el += icon('github:tag')
42
40
  el += '<span type="text" id="latest-tag-name">0</span>';
43
41
  el += '</div>';
44
42
  el += '</div>';
@@ -22,7 +22,7 @@ function layoutDiv() {
22
22
  return el;
23
23
  }
24
24
 
25
- el += '<widget class="widget-wrapper ghuser">';
25
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} ghuser">`
26
26
  // body
27
27
  el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
28
28
  if (item.avatar) {
@@ -42,13 +42,9 @@ 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="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>';
45
+ el += icon('github:logo')
46
46
  el += 'Follow';
47
47
  el += '</a>';
48
- // menu
49
- if (item.menu) {
50
- el += partial('../sidebar/menu', {where: 'sidebar'});
51
- }
52
48
  el += '</div>';
53
49
  el += '</widget>';
54
50
  return el;
@@ -0,0 +1,17 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} linklist">`
5
+ if (item.title?.length > 0) {
6
+ el += '<div class="widget-header dis-select">';
7
+ el += '<span class="name">' + item.title + '</span>';
8
+ el += '</div>';
9
+ }
10
+ el += '<div class="widget-body fs14">';
11
+ el += partial('components/linklist', {item: item})
12
+ el += '</div>';
13
+ el += '</widget>';
14
+ return el;
15
+ }
16
+ %>
17
+ <%- layoutDiv() %>
@@ -2,9 +2,9 @@
2
2
  function layoutDiv() {
3
3
  if (!item.content?.length && !item.src?.length) return ''
4
4
  var el = '';
5
- el += '<widget class="widget-wrapper markdown">';
5
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} markdown">`
6
6
  if (item.title?.length > 0) {
7
- el += '<div class="widget-header cap theme dis-select">';
7
+ el += '<div class="widget-header dis-select">';
8
8
  el += '<span class="name">' + item.title + '</span>';
9
9
  el += '</div>';
10
10
  }
@@ -15,6 +15,9 @@ function layoutDiv() {
15
15
  if (item.src) {
16
16
  el += `<div class="stellar-marked-api md-marked" src="${item.src}"></div>`
17
17
  }
18
+ if (item.linklist) {
19
+ el += partial('components/linklist', {item: item.linklist})
20
+ }
18
21
  el += '</div>';
19
22
  el += '</widget>';
20
23
  return el;
@@ -1,12 +1,12 @@
1
1
  <%
2
2
  function layoutDiv() {
3
- var el = '<widget class="widget-wrapper recent">';
3
+ var el = `<widget class="widget-wrapper${scrollreveal(' ')} post-list">`
4
4
  // header
5
- el += '<div class="widget-header cap theme dis-select">';
5
+ el += '<div class="widget-header dis-select">';
6
6
  el += '<span class="name">' + __("meta.recent_update") + '</span>';
7
7
  if (item.rss) {
8
8
  el += '<a class="cap-action" id="rss" title="Subscribe" href="' + item.rss + '">';
9
- el += '<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8938"><path d="M800.966 947.251c0-404.522-320.872-732.448-716.69-732.448V62.785c477.972 0 865.44 395.987 865.44 884.466h-148.75z m-162.273 0h-148.74c0-228.98-181.628-414.598-405.678-414.598v-152.01c306.205 0 554.418 253.68 554.418 566.608z m-446.24-221.12c59.748 0 108.189 49.503 108.189 110.557 0 61.063-48.44 110.563-108.188 110.563-59.747 0-108.18-49.5-108.18-110.563 0-61.054 48.433-110.556 108.18-110.556z" p-id="8939"></path></svg>';
9
+ el += icon('default:rss')
10
10
  el += '</a>';
11
11
  }
12
12
  el += '</div>';
@@ -25,20 +25,24 @@ function layoutDiv() {
25
25
  arr = site.posts.filter( p => p.title && p.title.length > 0)
26
26
  arr = arr.sort("updated", -1)
27
27
  }
28
- el += '<div class="widget-body related-posts fs14">';
28
+ el += '<div class="widget-body fs14">';
29
29
  arr.length = item.limit
30
30
  arr.forEach(post => {
31
31
  if (!post) { return }
32
- el += '<a class="item title" href="' + url_for(post.link || post.path) + '">';
32
+ const isActive = post.path == page.path
33
+ el += `<a class="item title${post.path == page.path ? ' active' : ''}" href="${url_for(post.link || post.path)}">`
33
34
  el += '<span class="title">'
34
- if (post.layout == 'wiki') {
35
- let proj = theme.wiki.tree[post.wiki];
35
+ if (post.wiki) {
36
+ const proj = theme.wiki.tree[post.wiki];
36
37
  let name = proj?.name || post?.wiki;
37
38
  if (name) {
38
39
  el += '<strong>' + name + '</strong>' + '<span class="dot"></span>';
39
40
  }
40
41
  }
41
- el += (post.title || post.seo_title || post.wiki) + '</span>';
42
+ el += (post.title || post.wiki) + '</span>';
43
+ if (isActive) {
44
+ el += icon('default:bookmark.active')
45
+ }
42
46
  el += '</a>';
43
47
  el += '';
44
48
  });
@@ -8,14 +8,18 @@ function relatedPostsInTopic() {
8
8
  return ''
9
9
  }
10
10
  var el = ''
11
- el += `<widget class="widget-wrapper recent">`
12
- el += `<div class="widget-header cap theme dis-select">`
11
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} post-list">`
12
+ el += `<div class="widget-header dis-select">`
13
13
  el += `<span class="name">${__('btn.topic') + __('symbol.colon') + topic.name}</span>`
14
14
  el += `</div>`
15
- el += `<div class="widget-body related-posts">`
15
+ el += `<div class="widget-body">`
16
16
  for (let post of topic.pages) {
17
- el += `<a class="item${post.path == page.path ? ' active' : ''}" href="${url_for(post.path)}">`
17
+ const isActive = post.path == page.path
18
+ el += `<a class="item${isActive ? ' active' : ''}" href="${url_for(post.path)}">`
18
19
  el += `<span class="title">${post.title}</span>`
20
+ if (isActive) {
21
+ el += icon('default:bookmark.active')
22
+ }
19
23
  el += `</a>`
20
24
  }
21
25
  el += `</div>`
@@ -30,11 +34,11 @@ function relatedWiki() {
30
34
  const relatedItems = thisItemObject.relatedItems
31
35
  var el = ''
32
36
  for (let relatedItem of relatedItems) {
33
- el += `<widget class="widget-wrapper related">`
34
- el += `<div class="widget-header cap theme dis-select">`
37
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} post-card">`
38
+ el += `<div class="widget-header dis-select">`
35
39
  el += `<span class="name">${__('meta.more') + __('symbol.colon') + relatedItem.name}</span>`
36
40
  el += `</div>`
37
- el += `<div class="widget-body related-posts">`
41
+ el += `<div class="widget-body">`
38
42
  for (let id of relatedItem.items) {
39
43
  // 同一个分组中的其它项目
40
44
  let item = theme.wiki.tree[id]
@@ -51,9 +55,9 @@ function relatedWiki() {
51
55
  return el
52
56
  }
53
57
  function layoutDiv() {
54
- if (page.layout == 'wiki') {
58
+ if (page.wiki?.length > 0) {
55
59
  return relatedWiki()
56
- } else if (page.layout == 'topic') {
60
+ } else if (page.topic?.length > 0) {
57
61
  return relatedPostsInTopic()
58
62
  }
59
63
  }
@@ -1,40 +0,0 @@
1
- <%
2
- function layoutDiv() {
3
- var el = '<widget class="widget-wrapper search">'
4
- el += '<div class="widget-body">'
5
- el += '<div class="search-wrapper" id="search-wrapper">'
6
- el += '<form class="search-form">'
7
- var filter = ''
8
- if (item.filter == 'auto') {
9
- if (page.layout == 'wiki') {
10
- let matches = page.path.match(/(.*?)\/(.*?)\//i)
11
- if (matches?.length > 0) {
12
- filter = matches[0]
13
- }
14
- }
15
- } else {
16
- if (item.filter?.length > 0) {
17
- filter = item.filter
18
- }
19
- }
20
- el += '<input type="text" class="search-input" id="search-input"'
21
- if (filter.length > 0) {
22
- if (!filter.startsWith('/')) {
23
- filter = '/' + filter
24
- }
25
- el += ' data-filter="' + filter + '"'
26
- el += ' placeholder="' + (item.placeholder || __('search.search_in', filter)) + '">'
27
- } else {
28
- el += ' placeholder="' + (item.placeholder || __('search.search')) + '">'
29
- }
30
- el += '<svg t="1705074644177" class="icon search-icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1560" width="200" height="200"><path d="M1008.839137 935.96571L792.364903 719.491476a56.783488 56.783488 0 0 0-80.152866 0 358.53545 358.53545 0 1 1 100.857314-335.166073 362.840335 362.840335 0 0 1-3.689902 170.145468 51.248635 51.248635 0 1 0 99.217358 26.444296 462.057693 462.057693 0 1 0-158.255785 242.303546l185.930047 185.725053a51.248635 51.248635 0 0 0 72.568068 0 51.248635 51.248635 0 0 0 0-72.978056z" p-id="1561"></path><path d="M616.479587 615.969233a50.428657 50.428657 0 0 0-61.498362-5.534852 174.655348 174.655348 0 0 1-177.525271 3.484907 49.403684 49.403684 0 0 0-58.833433 6.76482l-3.074918 2.869923a49.403684 49.403684 0 0 0 8.609771 78.10292 277.767601 277.767601 0 0 0 286.992355-5.739847 49.403684 49.403684 0 0 0 8.404776-76.667958z" p-id="1562"></path></svg>'
31
- el += '</form>'
32
- el += '<div id="search-result"></div>'
33
- el += '<div class="search-no-result">' + __('search.no_results') + '</div>'
34
- el += '</div>'
35
- el += '</div>'
36
- el += '</widget>'
37
- return el
38
- }
39
- %>
40
- <%- layoutDiv() %>
@@ -8,9 +8,9 @@ function layoutDiv() {
8
8
  delete opts['title'];
9
9
  delete opts['layout'];
10
10
  opts.class = 'tag ';
11
- el += '<widget class="widget-wrapper tagcloud">';
11
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} tagcloud">`
12
12
  if (item.title) {
13
- el += '<div class="widget-header cap theme dis-select">';
13
+ el += '<div class="widget-header dis-select">';
14
14
  el += '<span class="name">' + item.title + '</span>';
15
15
  el += '</div>';
16
16
  }
@@ -4,9 +4,9 @@ function layoutDiv() {
4
4
  if (item.api == undefined) {
5
5
  return el;
6
6
  }
7
- el += '<widget class="widget-wrapper timeline">';
7
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
8
8
  if (item.title) {
9
- el += '<div class="widget-header cap theme dis-select">';
9
+ el += '<div class="widget-header dis-select">';
10
10
  el += '<span class="name">' + item.title + '</span>';
11
11
  el += '</div>';
12
12
  }
@@ -1,5 +1,5 @@
1
1
  <%
2
- let proj = theme.wiki.tree[page.wiki];
2
+ const proj = theme.wiki.tree[page.wiki]
3
3
  var hasTOC = true
4
4
  function layoutTocBody() {
5
5
  if (toc(page.content).length > 0) {
@@ -16,7 +16,7 @@ function layoutTocBody() {
16
16
 
17
17
  function layoutTocHeader(title) {
18
18
  var el = ''
19
- el += `<div class="widget-header cap dis-select">`
19
+ el += `<div class="widget-header dis-select">`
20
20
  el += `<span class="name">${title || __("meta.toc")}</span>`
21
21
  el += `</div>`
22
22
  return el
@@ -40,6 +40,9 @@ function layoutDocTree(pages) {
40
40
  }
41
41
  el += `<a class="doc-tree-link${isActive}" href="${href}">`
42
42
  el += `<span class="toc-text">${p.title}</span>`
43
+ if (isActive.length > 0) {
44
+ el += icon('default:bookmark.active')
45
+ }
43
46
  el += `</a>`
44
47
  }
45
48
  if (p.path === page.path) {
@@ -53,12 +56,8 @@ function layoutDocTree(pages) {
53
56
 
54
57
  function layoutDiv(fallback) {
55
58
  var type = ''
56
- if (proj && proj.pages) {
57
- if (proj.pages.length > 1) {
58
- type = 'multi'
59
- } else {
60
- type = 'single'
61
- }
59
+ if (proj?.pages) {
60
+ type = proj.pages.length > 1 ? 'multi' : 'single'
62
61
  } else {
63
62
  let toc_content = toc(page.content)
64
63
  if (toc_content && toc_content.length > 0) {
@@ -68,19 +67,8 @@ function layoutDiv(fallback) {
68
67
 
69
68
  var el = ''
70
69
  if (type.length > 0) {
71
- el += `<widget class="widget-wrapper toc ${type}" id="data-toc" collapse="${item.collapse}">`
72
- if (page.layout !== 'wiki') {
73
- // post 布局
74
- el += layoutTocHeader(page.toc_title)
75
- el += `<div class="widget-body fs14">`
76
- el += `<div class="doc-tree active">`
77
- el += layoutTocBody()
78
- el += `</div>`
79
- el += `</div>`
80
- if (hasTOC == false) {
81
- return ''
82
- }
83
- } else if (proj) {
70
+ el += `<widget class="widget-wrapper${scrollreveal(' ')} toc ${type}" id="data-toc" collapse="${item.collapse}">`
71
+ if (proj) {
84
72
  // wiki 布局
85
73
  if (proj.sections && proj.sections.length > 0 && proj.pages.length > 1) { // 多 pages
86
74
  for (let sec of proj.sections) {
@@ -96,7 +84,7 @@ function layoutDiv(fallback) {
96
84
  }
97
85
  } else { // 单 page
98
86
  if (proj.pages.length == 1) {
99
- el += layoutTocHeader(page.toc_title)
87
+ el += layoutTocHeader()
100
88
  }
101
89
  el += `<div class="widget-body fs14">`
102
90
  el += layoutDocTree(proj.pages)
@@ -105,10 +93,22 @@ function layoutDiv(fallback) {
105
93
  return ''
106
94
  }
107
95
  }
108
- }
96
+ } else {
97
+ // post 布局
98
+ el += layoutTocHeader()
99
+ el += `<div class="widget-body fs14">`
100
+ el += `<div class="doc-tree active">`
101
+ el += layoutTocBody()
102
+ el += `</div>`
103
+ el += `</div>`
104
+ if (hasTOC == false) {
105
+ return ''
106
+ }
107
+ }
109
108
  el += `</widget>`
110
109
  } else if (item.fallback) {
111
- el += partial(item.fallback, {item: theme.data.widgets[item.fallback]})
110
+ const fallback = theme.widgets[item.fallback]
111
+ el += partial(fallback.layout, {item: fallback})
112
112
  }
113
113
  return el
114
114
  }
@@ -4,7 +4,7 @@ if (page.menu_id == undefined) {
4
4
  page.menu_id = 'post';
5
5
  }
6
6
  if (page.author) {
7
- page.header = 'auto';
7
+ page.header = false;
8
8
  }
9
9
  function layoutArchiveList() {
10
10
  var el = ''
@@ -24,7 +24,7 @@ function layoutArchiveList() {
24
24
  }
25
25
  })
26
26
  for (let year of years) {
27
- el += `<article class="${scrollreveal()}" id="archive">`
27
+ el += `<article class="${scrollreveal('')}" id="archive">`
28
28
  el += `<div class='archive-header h4'>${year}</div>`
29
29
  site.posts.sort('date', -1).filter(function (post) {
30
30
  post.year = date(post.date, 'YYYY')
@@ -9,7 +9,7 @@ if (page.menu_id == undefined) {
9
9
  <% page.layout = 'categories'; %>
10
10
  <%- partial('_partial/main/navbar/nav_tabs_blog') %>
11
11
  <div class='post-list'>
12
- <article class='<%- scrollreveal() %>' id='cats'>
12
+ <article class='<%- scrollreveal("") %>' id='cats'>
13
13
  <% site.categories.sort('path').each(function(category){ %>
14
14
  <div>
15
15
  <a class="<%= category.parent ? 'cat child' : 'cat'%>" href="<%= url_for(category.path) %>">
package/layout/index.ejs CHANGED
@@ -12,7 +12,7 @@ function layout_post_card(layout, post, content) {
12
12
  if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
13
13
  layout += ' photo';
14
14
  }
15
- el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
15
+ el += `<a class="post-card${scrollreveal(' ')} ${layout}" href="${url_for(post.link || post.path)}">`
16
16
  el += content;
17
17
  el += '</a>';
18
18
  return el;
@@ -21,25 +21,9 @@ function layout_post_card(layout, post, content) {
21
21
  function layout_post_list(partial) {
22
22
  var el = '';
23
23
  el += '<div class="post-list post">';
24
- if (is_home()) {
25
- // pinned posts
26
- if (page.current == 1) {
27
- var pinned = site.posts.filter(post => post.pin != undefined).sort((config.index_generator && config.index_generator.order_by) || '-date');
28
- pinned.forEach((post, i) => {
29
- el += layout_post_card('post', post, partial(post));
30
- });
31
- }
32
- // unpinned posts
33
- page.posts.each(function(post){
34
- if (post.pin == undefined) {
35
- el += layout_post_card('post', post, partial(post));
36
- }
37
- })
38
- } else {
39
- page.posts.each(function(post){
40
- el += layout_post_card('post', post, partial(post));
41
- })
42
- }
24
+ page.posts.each(function(post){
25
+ el += layout_post_card('post', post, partial(post));
26
+ })
43
27
  el += '</div>';
44
28
  return el;
45
29
  }
@@ -8,7 +8,7 @@ function layout_topic_list(partial) {
8
8
  continue
9
9
  }
10
10
  el += `<div class="post-list wiki topic">`
11
- el += `<a class="post-card wiki topic ${scrollreveal()}" href="${url_for(topic.homepage?.path || '/')}">`
11
+ el += `<a class="post-card wiki topic${scrollreveal(' ')}" href="${url_for(topic.homepage?.path || '/')}">`
12
12
  el += partial(topic)
13
13
  el += `</a>`
14
14
  el += `</div>`
@@ -13,14 +13,14 @@ function layout_wiki_list(partial) {
13
13
  if (page.filter === false) {
14
14
  // wikiList
15
15
  el += `<div class="post-list wiki">`
16
- el += `<a class="post-card wiki ${scrollreveal()}" href="${url_for(proj.homepage?.path || '/')}">`
16
+ el += `<a class="post-card wiki${scrollreveal(' ')}" href="${url_for(proj.homepage?.path || '/')}">`
17
17
  el += partial(proj)
18
18
  el += `</a>`
19
19
  el += `</div>`
20
20
  } else if (proj.tags && proj.tags.includes(page.tagName) === true) {
21
21
  // filtered wikiList
22
22
  el += `<div class="post-list wiki filter">`
23
- el += `<a class="post-card wiki ${scrollreveal()}" href="${url_for(proj.homepage?.path || '/')}">`
23
+ el += `<a class="post-card wiki${scrollreveal(' ')}" href="${url_for(proj.homepage?.path || '/')}">`
24
24
  el += partial(proj)
25
25
  el += `</a>`
26
26
  el += `</div>`
package/layout/layout.ejs CHANGED
@@ -1,21 +1,53 @@
1
- <!DOCTYPE html>
2
- <html lang='<%- page.lang %>'>
3
- <%- partial('_partial/head') %>
4
- <body>
5
- <%- partial('_partial/cover/index') %>
6
- <div class='l_body' id='start'>
7
- <aside class='l_left' layout='<%- page.layout %>'>
8
- <%- partial('_partial/sidebar/index') %>
9
- </aside>
10
- <div class='l_main<%- page.content ? "" : " list" %>'>
11
- <%- partial('_partial/main/header/index') %>
12
- <%- body %>
13
- <%- partial('_partial/main/footer') %>
14
- <%- partial('_partial/menubtn') %>
15
- </div>
16
- </div>
17
- <div class='scripts'>
18
- <%- partial('_partial/scripts/index') %>
19
- </div>
20
- </body>
21
- </html>
1
+ <%
2
+ // 页面类型:索引页面还是内容页面
3
+ var page_type = 'index'
4
+ if (['post', 'page', 'wiki', null].includes(page.layout)) {
5
+ if (!page.nav_tabs) {
6
+ page_type = 'content'
7
+ }
8
+ }
9
+ // 文章类型:技术类文章/文学类文章
10
+ var article_type = theme.article.type
11
+ if (page.type?.length > 0) {
12
+ article_type = page.type
13
+ }
14
+ // 是否缩进
15
+ var indent = false
16
+ if (page.indent != null) {
17
+ indent = page.indent
18
+ } else if (theme.topic.tree[page.topic]?.indent != null) {
19
+ indent = theme.topic.tree[page.topic]?.indent
20
+ } else if (theme.wiki.tree[page.wiki]?.indent != null) {
21
+ indent = theme.wiki.tree[page.wiki]?.indent
22
+ } else if (theme.article.indent != null) {
23
+ indent = theme.article.indent
24
+ } else {
25
+ indent = article_type === 'story'
26
+ }
27
+
28
+ var html = `<!DOCTYPE html>`
29
+ html += `<html lang="${page.lang}">`
30
+ html += partial('_partial/head')
31
+ html += `<body>`
32
+ html += partial('_partial/cover/index')
33
+ html += `<div class="l_body ${page_type} ${article_type}" id="start" layout="${page.layout}" ${indent ? 'text-indent' : ''}>`
34
+ html += `<aside class="l_left">`
35
+ html += `<div class="sidebar-container${theme.style.sidebar?.blur ? ' sidebar-blur' : ''}">`
36
+ html += partial('_partial/sidebar/index')
37
+ html += `</div>`
38
+ html += `</aside>`
39
+ html += `<div class="l_main" id="main">`
40
+ html += partial('_partial/sidebar/logo', {where: 'main'})
41
+ html += body
42
+ html += partial('_partial/main/footer')
43
+ html += partial('_partial/menubtn')
44
+ html += `<div class="main-mask" onclick="sidebar.toggle()"></div>`
45
+ html += `</div>`
46
+ html += `</div>`
47
+ html += `<div class="scripts">`
48
+ html += partial('_partial/scripts/index')
49
+ html += `</div>`
50
+ html += `</body>`
51
+ html += `</html>`
52
+ %>
53
+ <%- html %>