hexo-theme-stellar 1.24.1 → 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 (136) hide show
  1. package/_config.yml +122 -50
  2. package/_data/icons.yml +33 -0
  3. package/_data/widgets.yml +2 -16
  4. package/languages/en.yml +2 -1
  5. package/languages/zh-CN.yml +3 -2
  6. package/languages/zh-TW.yml +3 -2
  7. package/layout/404.ejs +2 -4
  8. package/layout/_partial/cover/index.ejs +5 -5
  9. package/layout/_partial/cover/post_cover.ejs +1 -1
  10. package/layout/_partial/cover/wiki_cover.ejs +2 -2
  11. package/layout/_partial/head.ejs +6 -9
  12. package/layout/_partial/main/article/article_footer.ejs +16 -24
  13. package/layout/_partial/main/article/read_next.ejs +13 -13
  14. package/layout/_partial/main/article/related_posts.ejs +1 -1
  15. package/layout/_partial/main/footer.ejs +1 -1
  16. package/layout/_partial/main/navbar/article_top_area.ejs +35 -0
  17. package/layout/_partial/main/navbar/author_banner.ejs +1 -3
  18. package/layout/_partial/main/navbar/breadcrumb/blog.ejs +34 -0
  19. package/layout/_partial/main/navbar/breadcrumb/page.ejs +10 -0
  20. package/layout/_partial/main/navbar/breadcrumb/wiki.ejs +20 -0
  21. package/layout/_partial/main/navbar/dateinfo.ejs +32 -0
  22. package/layout/_partial/main/navbar/ghinfo.ejs +25 -0
  23. package/layout/_partial/main/navbar/{list_post.ejs → nav_tabs_blog.ejs} +15 -7
  24. package/layout/_partial/main/navbar/{list_wiki.ejs → nav_tabs_wiki.ejs} +15 -1
  25. package/layout/_partial/main/post_list/paginator.ejs +1 -1
  26. package/layout/_partial/main/post_list/post_card.ejs +4 -15
  27. package/layout/_partial/main/post_list/topic_card.ejs +16 -0
  28. package/layout/_partial/menubtn.ejs +1 -1
  29. package/layout/_partial/plugins/ai/tianli_gpt.ejs +4 -3
  30. package/layout/_partial/plugins/comments/artalk/layout.ejs +1 -1
  31. package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
  32. package/layout/_partial/plugins/comments/beaudar/layout.ejs +1 -1
  33. package/layout/_partial/plugins/comments/giscus/layout.ejs +1 -1
  34. package/layout/_partial/plugins/comments/layout.ejs +3 -3
  35. package/layout/_partial/plugins/comments/twikoo/layout.ejs +1 -1
  36. package/layout/_partial/plugins/comments/utterances/layout.ejs +1 -1
  37. package/layout/_partial/plugins/comments/waline/layout.ejs +1 -1
  38. package/layout/_partial/sidebar/index.ejs +92 -83
  39. package/layout/_partial/sidebar/logo.ejs +87 -0
  40. package/layout/_partial/sidebar/menu.ejs +23 -18
  41. package/layout/_partial/sidebar/search.ejs +42 -0
  42. package/layout/_partial/widgets/components/link.ejs +21 -0
  43. package/layout/_partial/widgets/components/linklist.ejs +27 -0
  44. package/layout/_partial/widgets/ghissues.ejs +7 -9
  45. package/layout/_partial/widgets/ghrepo.ejs +10 -12
  46. package/layout/_partial/widgets/ghuser.ejs +2 -6
  47. package/layout/_partial/widgets/linklist.ejs +17 -0
  48. package/layout/_partial/widgets/markdown.ejs +5 -2
  49. package/layout/_partial/widgets/recent.ejs +12 -8
  50. package/layout/_partial/widgets/related.ejs +51 -20
  51. package/layout/_partial/widgets/search.ejs +0 -40
  52. package/layout/_partial/widgets/tagcloud.ejs +2 -2
  53. package/layout/_partial/widgets/timeline.ejs +2 -2
  54. package/layout/_partial/widgets/toc.ejs +61 -53
  55. package/layout/archive.ejs +3 -3
  56. package/layout/categories.ejs +2 -2
  57. package/layout/index.ejs +10 -62
  58. package/layout/index_topic.ejs +28 -0
  59. package/layout/index_wiki.ejs +42 -0
  60. package/layout/layout.ejs +53 -21
  61. package/layout/page.ejs +60 -13
  62. package/layout/tags.ejs +2 -2
  63. package/package.json +2 -2
  64. package/scripts/events/index.js +5 -0
  65. package/scripts/events/lib/authors.js +1 -1
  66. package/scripts/events/lib/config.js +28 -24
  67. package/scripts/events/lib/doc_tree.js +27 -19
  68. package/scripts/events/lib/merge_posts.js +46 -0
  69. package/scripts/events/lib/topic_tree.js +45 -0
  70. package/scripts/generators/404.js +8 -3
  71. package/scripts/generators/author.js +4 -2
  72. package/scripts/generators/categories.js +4 -4
  73. package/scripts/generators/tags.js +4 -4
  74. package/scripts/generators/topic.js +21 -0
  75. package/scripts/generators/wiki.js +30 -28
  76. package/scripts/helpers/category_color.js +1 -1
  77. package/scripts/helpers/icon.js +16 -0
  78. package/scripts/helpers/parse_config.js +20 -18
  79. package/scripts/helpers/scrollreveal.js +6 -6
  80. package/scripts/tags/lib/audio.js +9 -4
  81. package/scripts/tags/lib/navbar.js +1 -1
  82. package/scripts/tags/lib/toc.js +1 -1
  83. package/scripts/tags/lib/video.js +8 -8
  84. package/source/css/_common/blur.styl +5 -9
  85. package/source/css/_common/cap.styl +1 -1
  86. package/source/css/_common/device.styl +2 -2
  87. package/source/css/_common/highlight.styl +3 -2
  88. package/source/css/_common/layout.styl +6 -0
  89. package/source/css/_common/svg.styl +3 -0
  90. package/source/css/_custom.styl +9 -2
  91. package/source/css/_defines/theme.styl +10 -0
  92. package/source/css/_layout/layout.styl +17 -4
  93. package/source/css/_layout/list.styl +5 -2
  94. package/source/css/_layout/main.styl +5 -4
  95. package/source/css/_layout/md.styl +12 -11
  96. package/source/css/_layout/partial/paginator.styl +2 -2
  97. package/source/css/_layout/partial/related.styl +3 -0
  98. package/source/css/_layout/sidebar/footer.styl +4 -31
  99. package/source/css/_layout/sidebar/{header.styl → logo.styl} +11 -41
  100. package/source/css/_layout/sidebar/menu.styl +53 -0
  101. package/source/css/_layout/sidebar/nav-area.styl +2 -0
  102. package/source/css/_layout/sidebar/search.styl +106 -0
  103. package/source/css/_layout/sidebar/sidebar.styl +21 -31
  104. package/source/css/_layout/tag-plugins/banner.styl +9 -7
  105. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  106. package/source/css/_layout/tag-plugins/okr.styl +0 -1
  107. package/source/css/_layout/tag-plugins/tabs.styl +2 -2
  108. package/source/css/_layout/tag-plugins/toc.styl +1 -1
  109. package/source/css/_layout/widgets/components.styl +49 -0
  110. package/source/css/_layout/widgets/ghrepo.styl +0 -1
  111. package/source/css/_layout/widgets/ghuser.styl +0 -23
  112. package/source/css/_layout/widgets/list.styl +28 -0
  113. package/source/css/_layout/widgets/markdown.styl +20 -0
  114. package/source/css/_layout/widgets/related.styl +36 -5
  115. package/source/css/_layout/widgets/timeline.styl +21 -2
  116. package/source/css/_layout/widgets/toc_blog.styl +1 -1
  117. package/source/css/_layout/widgets/toc_common.styl +12 -12
  118. package/source/css/_layout/widgets/toc_wiki.styl +38 -25
  119. package/source/css/_layout/widgets/widgets.styl +25 -20
  120. package/source/css/_plugins/comments/twikoo.styl +9 -9
  121. package/source/css/_plugins/scrollreveal.styl +1 -1
  122. package/source/css/_plugins/tianli_gpt.styl +12 -14
  123. package/source/js/main.js +5 -2
  124. package/source/js/plugins/copycode.js +3 -3
  125. package/source/js/plugins/fcircle.js +1 -1
  126. package/source/js/plugins/friends.js +1 -1
  127. package/source/js/plugins/memos.js +1 -1
  128. package/source/js/plugins/sites.js +2 -2
  129. package/source/js/plugins/weibo.js +1 -1
  130. package/layout/_partial/main/header/index.ejs +0 -3
  131. package/layout/_partial/main/navbar/breadcrumb.ejs +0 -139
  132. package/layout/_partial/sidebar/header.ejs +0 -59
  133. package/layout/post.ejs +0 -33
  134. package/layout/wiki.ejs +0 -43
  135. package/source/css/_layout/widgets/recent.styl +0 -15
  136. package/source/css/_layout/widgets/search.styl +0 -102
@@ -1,34 +1,48 @@
1
1
  <%
2
- var proj;
3
- if (page.layout === 'wiki' && page.wiki) {
4
- proj = theme.wiki.tree[page.wiki];
5
- }
6
- // 默认组件
7
- if (page.sidebar == undefined) {
8
- if (page.layout == 'post' && page.content) {
9
- page.sidebar = theme.sidebar.widgets.post;
10
- } else if (page.layout == 'wiki' && page.wiki) {
11
- let proj = theme.wiki.tree[page.wiki];
12
- if (proj?.sidebar) {
13
- page.sidebar = proj.sidebar;
14
- } else {
15
- page.sidebar = theme.sidebar.widgets.wiki;
16
- }
17
- } else if (is_home()) {
18
- page.sidebar = theme.sidebar.widgets.home;
2
+
3
+ const wiki = theme.wiki.tree[page.wiki]
4
+ const topic = theme.topic.tree[page.topic]
5
+
6
+ if (page.sidebar == null) {
7
+ const { site_tree } = theme
8
+ var sidebar
9
+ if (is_home()) {
10
+ sidebar = site_tree.home.sidebar
19
11
  } else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
20
- page.sidebar = theme.sidebar.widgets.blog_index;
21
- } else if (['wiki_index'].includes(page.layout)) {
22
- page.sidebar = theme.sidebar.widgets.wiki_index;
23
- } else if (['404', undefined].includes(page.layout)) {
24
- page.sidebar = theme.sidebar.widgets.others;
25
- } else if (page.layout == 'page') {
26
- page.sidebar = theme.sidebar.widgets.page;
12
+ sidebar = site_tree.index_blog.sidebar
13
+ } else if (page.layout === 'index_topic') {
14
+ // 专栏列表页等同于博客列表页
15
+ sidebar = site_tree.index_blog.sidebar
16
+ } else if (page.topic?.length > 0) {
17
+ // 专栏文章内页等同于普通文章内页
18
+ sidebar = site_tree.post.sidebar
19
+ } else if (page.layout === 'index_wiki') {
20
+ sidebar = site_tree.index_wiki.sidebar
21
+ } else if (page.wiki?.length > 0) {
22
+ sidebar = site_tree.wiki.sidebar
23
+ } else if (page.layout === '404') {
24
+ sidebar = site_tree.error_page.sidebar
25
+ } else if (page.layout === 'page') {
26
+ sidebar = site_tree.page.sidebar
27
+ } else if (page.layout === 'post') {
28
+ sidebar = site_tree.post.sidebar
29
+ } else if (page.layout == null) {
30
+ sidebar = site_tree.page.sidebar
27
31
  } else {
28
- page.sidebar = [];
32
+ sidebar = []
33
+ }
34
+
35
+ if (topic?.sidebar) {
36
+ sidebar = topic.sidebar
29
37
  }
38
+ if (wiki?.sidebar) {
39
+ sidebar = wiki.sidebar
40
+ }
41
+
42
+ page.sidebar = sidebar
30
43
  }
31
44
 
45
+
32
46
  // parse array string
33
47
  if (typeof page.sidebar == 'string') {
34
48
  page.sidebar = page.sidebar.replace(/ /g, '').split(',');
@@ -52,31 +66,6 @@ function layoutTitle(main, url, sub) {
52
66
  function layoutWidgets() {
53
67
  var el = '';
54
68
  el += '<div class="widgets">';
55
- if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') {
56
- el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
57
- // all products
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="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
- el += __('btn.all_wiki');
61
- el += '</a>';
62
- // this product
63
- if (proj == undefined) {
64
- // 如果没有项目名,则使用menu中显示的名字
65
- if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) {
66
- proj = {
67
- path: md_link(theme.sidebar.menu[page.menu_id]),
68
- wiki: __(md_text(theme.sidebar.menu[page.menu_id]))
69
- };
70
- }
71
- }
72
- if (proj != undefined) {
73
- let main = proj.name || proj.title || page.wiki || page.title;
74
- let url = proj.homepage.path;
75
- let sub = proj.subtitle;
76
- el += layoutTitle(main, url, sub);
77
- }
78
- el += '</div></widget>';
79
- }
80
69
  if (page.sidebar) {
81
70
  page.sidebar.forEach((w, i) => {
82
71
  let name = ''
@@ -86,8 +75,8 @@ function layoutWidgets() {
86
75
  } else if (typeof w == 'object' && w.override) {
87
76
  name = w.override
88
77
  }
89
- if (name in theme.data.widgets) {
90
- Object.assign(widget, theme.data.widgets[name])
78
+ if (name in theme.widgets) {
79
+ Object.assign(widget, theme.widgets[name])
91
80
  }
92
81
  if (typeof w == 'object' && (w.override || w.layout)) {
93
82
  Object.assign(widget, w)
@@ -101,42 +90,62 @@ function layoutWidgets() {
101
90
  return el;
102
91
  }
103
92
  function layoutFooterDiv() {
104
- if (page.layout !== 'wiki' && theme.footer.social) {
105
- var el = '<footer class="footer dis-select">';
106
- el += '<div class="social-wrap">';
107
- for (let id of Object.keys(theme.footer.social)) {
108
- let item = theme.footer.social[id];
109
- if (item.icon && (item.url || item.onclick)) {
110
- el += '<a class="social"';
111
- if (item.title) {
112
- el += ' title="' + item.title + '"';
113
- }
114
- if (item.url) {
115
- el += ' href="' + url_for(item.url) + '"';
116
- if (item.url.includes('://')) {
117
- el += ' target="_blank" rel="external nofollow noopener noreferrer"';
118
- } else {
119
- el += ' rel="noopener noreferrer"';
120
- }
121
- } else if (item.onclick) {
122
- item.onclick = item.onclick.replace(/"|\'/g, '&quot;');
123
- el += ' onclick="' + item.onclick + '"';
93
+ const { social } = theme.footer
94
+ if (social == null) {
95
+ return ''
96
+ }
97
+ var el = '<footer class="footer dis-select">';
98
+ el += '<div class="social-wrap">';
99
+ for (let id of Object.keys(social)) {
100
+ let item = social[id];
101
+ if (item.icon && (item.url || item.onclick)) {
102
+ el += '<a class="social"';
103
+ if (item.title) {
104
+ el += ' title="' + item.title + '"';
105
+ }
106
+ if (item.url) {
107
+ el += ' href="' + url_for(item.url) + '"';
108
+ if (item.url.includes('://')) {
109
+ el += ' target="_blank" rel="external nofollow noopener noreferrer"';
110
+ } else {
111
+ el += ' rel="noopener noreferrer"';
124
112
  }
125
- el += '>';
126
- el += item.icon;
127
- el += '</a>';
113
+ } else if (item.onclick) {
114
+ item.onclick = item.onclick.replace(/"|\'/g, '&quot;');
115
+ el += ' onclick="' + item.onclick + '"';
128
116
  }
117
+ el += '>';
118
+ el += item.icon;
119
+ el += '</a>';
129
120
  }
130
- el += '</div>';
131
- el += '</footer>';
132
- return el;
133
- } else {
134
- return '';
135
121
  }
122
+ el += '</div>';
123
+ el += '</footer>';
124
+ return el;
125
+ }
126
+
127
+ function layoutLogo() {
128
+ return partial('logo', {where: 'sidebar'})
129
+ }
130
+
131
+ function layoutNavArea() {
132
+ var search = {}
133
+ if (page.search) {
134
+ search = page.search
135
+ } else if (wiki?.search) {
136
+ search = wiki.search
137
+ } else if (topic?.search) {
138
+ search = topic.search
139
+ }
140
+ var el = ''
141
+ el += `<div class="nav-area">`
142
+ el += partial('search', {item: search})
143
+ el += partial('menu', {where: 'sidebar'})
144
+ el += `</div>`
145
+ return el
136
146
  }
137
147
  %>
138
- <% if (page.header == undefined || page.header == 'left' || page.header == 'auto') { %>
139
- <%- partial('header', {where: 'sidebar'}) %>
140
- <% } %>
148
+ <%- layoutLogo() %>
149
+ <%- layoutNavArea() %>
141
150
  <%- layoutWidgets() %>
142
151
  <%- layoutFooterDiv() %>
@@ -0,0 +1,87 @@
1
+ <%
2
+ var logo = theme.logo
3
+ if (page.logo) {
4
+ logo = Object.assign({}, logo, page.logo)
5
+ } else if (theme.wiki.tree[page.wiki]) {
6
+ const proj = theme.wiki.tree[page.wiki]
7
+ var l = proj.logo
8
+ if (l) {
9
+ logo = l
10
+ } else if (proj.name || proj.icon) {
11
+ logo = {
12
+ icon: proj.icon || theme.default.project,
13
+ title: `[${proj.name || proj.title}](${url_for(proj.homepage?.path || '')})`,
14
+ subtitle: proj.subtitle
15
+ }
16
+ }
17
+ } else if (theme.topic.tree[page.topic]) {
18
+ const topic = theme.topic.tree[page.topic]
19
+ var l = topic.logo
20
+ if (l) {
21
+ logo = l
22
+ } else if (topic.name || topic.icon) {
23
+ logo = {
24
+ icon: topic.icon || theme.default.topic,
25
+ title: `[${topic.name || topic.title}](${url_for(topic.homepage?.path || '')})`,
26
+ subtitle: topic.subtitle
27
+ }
28
+ }
29
+ }
30
+
31
+ // logo.icon, logo.title, logo.subtitle, logo.url
32
+ function layoutTitle(main, url, sub) {
33
+ var el = ''
34
+ el += `<a class="title" href="${url_for(url || "/")}">`
35
+ el += `<div class="main" ff="title">${main}</div>`
36
+ if (sub) {
37
+ const arr = sub.split('|')
38
+ if (arr.length > 1) {
39
+ el += `<div class="sub normal cap">${arr.shift().trim()}</div>`
40
+ el += `<div class="sub hover cap" style="opacity:0">${arr.join('|')}</div>`
41
+ } else {
42
+ el += `<div class="sub cap">${sub}</div>`
43
+ }
44
+ }
45
+ el += `</a>`
46
+ return el
47
+ }
48
+
49
+ function layoutDiv() {
50
+ if (where == 'main') {
51
+ if (page.header == false) {
52
+ return ''
53
+ }
54
+ // 内容页如果未设置 header 则不显示
55
+ if (page.header == null) {
56
+ if (!page.nav_tabs) { // 如果有 nav_tabs 就代表是列表页
57
+ if (page.layout === 'post' || page.layout === 'page' || page.wiki) {
58
+ return ''
59
+ }
60
+ }
61
+ }
62
+ }
63
+ var el = ''
64
+ el += `<header class="header${where == 'main' ? ' mobile-only' : ''}">`
65
+ el += `<div class="logo-wrap">`
66
+ if (logo.icon) {
67
+ el += `<div class="icon"><img no-lazy class="icon" src="${md_text(logo.icon)}"></div>`
68
+ } else if (md_text(logo.avatar)) {
69
+ el += `<a class="avatar" href="${url_for(md_link(logo.avatar) || '/')}">`
70
+ if (theme.style.animated_avatar.animate) {
71
+ el += `<div class="bg" style="opacity:0;background-image:url(${theme.style.animated_avatar.background});"></div>`
72
+ }
73
+ el += `<img no-lazy class="avatar" src="${md_text(logo.avatar)}">`
74
+ el += `</a>`
75
+ }
76
+ const main = md_text(logo.title)
77
+ if (main) {
78
+ let url = md_link(logo.title)
79
+ el += layoutTitle(main, url, logo.subtitle)
80
+ }
81
+ el += `</div>`
82
+ el += '</header>'
83
+ return el
84
+ }
85
+ %>
86
+
87
+ <%- layoutDiv() %>
@@ -1,26 +1,31 @@
1
1
  <%
2
2
  function layoutDiv() {
3
- var el = '';
4
- el += '<nav class="menu dis-select';
5
- if (where == 'main') {
6
- el += ' mobile-hidden';
7
- }
8
- el += '">';
9
- for (let id of Object.keys(theme.sidebar.menu)) {
10
- let item = theme.sidebar.menu[id];
11
- if (item == undefined || item.length == 0) {
12
- continue;
3
+ var el = ''
4
+ el += `<nav class="menu dis-select${where == 'main' ? ' mobile-hidden' : ''}">`
5
+ for (let item of theme.menubar.items) {
6
+ if (item == undefined || item.id == null || item.url == null) {
7
+ continue
8
+ }
9
+ el += `<a class="nav-item${item.id == page.menu_id ? ' active' : ''}" title="${item.title}" href="${url_for(item.url)}"`
10
+ if (item.theme?.length > 0) {
11
+ el += ` style="color:${item.theme}"`
13
12
  }
14
- el += '<a class="nav-item';
15
- if (id == page.menu_id) {
16
- el += ' active';
13
+ el += `>`
14
+ if (item.icon?.length > 0) {
15
+ if (item.icon.startsWith('<')) {
16
+ el += item.icon
17
+ } else if (theme.icons[item.icon]) {
18
+ el += theme.icons[item.icon]
19
+ } else {
20
+ el += `<img no-lazy src="${item.icon}">`
21
+ }
22
+ } else {
23
+ el += `<span>${__(item.title)}</span>`
17
24
  }
18
- el += '" href="' + url_for(md_link(item)) + '">';
19
- el += __(md_text(item));
20
- el += '</a>';
25
+ el += `</a>`
21
26
  }
22
- el += '</nav>';
23
- return el;
27
+ el += `</nav>`
28
+ return el
24
29
  }
25
30
  %>
26
31
 
@@ -0,0 +1,42 @@
1
+ <%
2
+ if (item.filter == null) {
3
+ item.filter = 'auto'
4
+ }
5
+ function layoutDiv() {
6
+ var el = ''
7
+ el += `<div class="search-wrapper" id="search-wrapper">`
8
+ el += `<form class="search-form">`
9
+ var filter = ''
10
+ if (item.filter == 'auto') {
11
+ if (page.wiki) {
12
+ let matches = page.path.match(/(.*?)\/(.*?)\//i)
13
+ if (matches?.length > 0) {
14
+ filter = matches[0]
15
+ }
16
+ }
17
+ } else {
18
+ if (item.filter?.length > 0) {
19
+ filter = item.filter
20
+ }
21
+ }
22
+ el += `<a class="search-button" onclick="document.getElementById(&quot;search-input&quot;).focus();">`
23
+ el += icon('default:search')
24
+ el += `</a>`
25
+ el += `<input type="text" class="search-input" id="search-input"`
26
+ if (filter.length > 0) {
27
+ if (!filter.startsWith('/')) {
28
+ filter = '/' + filter
29
+ }
30
+ el += ` data-filter="${filter}"`
31
+ el += ` placeholder="${item.placeholder || __('search.search_in', filter)}">`
32
+ } else {
33
+ el += ` placeholder="${item.placeholder || __('search.search')}">`
34
+ }
35
+ el += `</form>`
36
+ el += `<div id="search-result"></div>`
37
+ el += `<div class="search-no-result">${__('search.no_results')}</div>`
38
+ el += `</div>`
39
+ return el
40
+ }
41
+ %>
42
+ <%- layoutDiv() %>
@@ -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
  });