hexo-theme-stellar 1.10.0 → 1.12.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 (73) hide show
  1. package/_config.yml +39 -56
  2. package/_data/widgets.yml +70 -0
  3. package/languages/en.yml +0 -1
  4. package/languages/zh-CN.yml +4 -5
  5. package/languages/zh-TW.yml +4 -5
  6. package/layout/_partial/main/article/read_next.ejs +16 -17
  7. package/layout/_partial/main/navbar/breadcrumb.ejs +1 -1
  8. package/layout/_partial/main/navbar/list_post.ejs +2 -2
  9. package/layout/_partial/main/post_list/post_card.ejs +21 -15
  10. package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
  11. package/layout/_partial/sidebar/header.ejs +2 -26
  12. package/layout/_partial/sidebar/index.ejs +6 -6
  13. package/layout/_partial/sidebar/logo.ejs +3 -3
  14. package/layout/_partial/sidebar/menu.ejs +27 -0
  15. package/layout/_partial/sidebar/widgets/ghissues.ejs +46 -0
  16. package/layout/_partial/sidebar/widgets/ghrepo.ejs +53 -0
  17. package/layout/_partial/sidebar/widgets/ghuser.ejs +9 -11
  18. package/layout/_partial/sidebar/widgets/markdown.ejs +1 -1
  19. package/layout/_partial/sidebar/widgets/recent.ejs +8 -11
  20. package/layout/_partial/sidebar/widgets/{wiki_more.ejs → related.ejs} +7 -7
  21. package/layout/_partial/sidebar/widgets/tagcloud.ejs +24 -0
  22. package/layout/_partial/sidebar/widgets/timeline.ejs +27 -0
  23. package/layout/_partial/sidebar/widgets/toc.ejs +2 -6
  24. package/layout/index.ejs +1 -1
  25. package/package.json +1 -1
  26. package/scripts/events/lib/config.js +26 -10
  27. package/scripts/events/lib/doc_tree.js +3 -0
  28. package/scripts/helpers/related_posts.js +11 -39
  29. package/scripts/tags/about.js +10 -7
  30. package/scripts/tags/{grid.js → border.js} +4 -4
  31. package/scripts/tags/folders.js +55 -0
  32. package/scripts/tags/link.js +11 -9
  33. package/scripts/tags/navbar.js +1 -1
  34. package/scripts/tags/sites.js +1 -1
  35. package/scripts/tags/split.js +51 -0
  36. package/scripts/tags/timeline.js +4 -2
  37. package/source/css/_common/base.styl +5 -2
  38. package/source/css/_common/blur.styl +3 -0
  39. package/source/css/_common/device.styl +2 -0
  40. package/source/css/_common/highlight.styl +1 -1
  41. package/source/css/_common/loading.styl +16 -3
  42. package/source/css/_common/title.styl +0 -13
  43. package/source/css/_custom.styl +23 -26
  44. package/source/css/_defines/theme.styl +12 -12
  45. package/source/css/_layout/list.styl +40 -9
  46. package/source/css/_layout/md.styl +2 -2
  47. package/source/css/_layout/partial/related.styl +62 -93
  48. package/source/css/_layout/sidebar/footer.styl +4 -2
  49. package/source/css/_layout/sidebar/ghrepo.styl +36 -0
  50. package/source/css/_layout/sidebar/ghuser.styl +19 -1
  51. package/source/css/_layout/sidebar/sidebar.styl +4 -91
  52. package/source/css/_layout/sidebar/toc_common.styl +5 -3
  53. package/source/css/_layout/sidebar/widgets.styl +104 -0
  54. package/source/css/_layout/tag-plugins/about.styl +21 -17
  55. package/source/css/_layout/tag-plugins/common.styl +36 -31
  56. package/source/css/_layout/tag-plugins/folders.styl +62 -0
  57. package/source/css/_layout/tag-plugins/link.styl +41 -27
  58. package/source/css/_layout/tag-plugins/navbar.styl +10 -4
  59. package/source/css/_layout/tag-plugins/poetry.styl +1 -1
  60. package/source/css/_layout/tag-plugins/quot.styl +8 -7
  61. package/source/css/_layout/tag-plugins/split.styl +28 -0
  62. package/source/css/_layout/tag-plugins/timeline.styl +69 -41
  63. package/source/css/_plugins/comments/twikoo.styl +12 -6
  64. package/source/css/_plugins/comments/valine.styl +4 -0
  65. package/source/css/_plugins/comments/waline.styl +2 -2
  66. package/source/js/main.js +14 -8
  67. package/source/js/plugins/friends.js +3 -2
  68. package/source/js/plugins/ghinfo.js +14 -2
  69. package/source/js/plugins/linkcard.js +124 -0
  70. package/source/js/plugins/sites.js +4 -3
  71. package/source/js/plugins/timeline.js +60 -33
  72. package/layout/_partial/sidebar/widgets/repo_info.ejs +0 -91
  73. package/source/css/_layout/sidebar/repo_info.styl +0 -31
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.10.0'
3
+ version: '1.12.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
@@ -24,51 +24,11 @@ sidebar:
24
24
  # friends: '[友链](/friends/)'
25
25
  # about: '[关于](/about/)'
26
26
  # Sidebar widgets
27
- widget_layout:
28
- index: [welcome, recent, ghuser_mini] # for home/wiki/categories/tags/archives/404 pages
29
- page: [welcome, toc] # for pages using 'layout:page'
30
- post: [toc, repo_info] # for pages using 'layout:post'
31
- wiki: [toc, repo_info, wiki_more] # for pages using 'layout:wiki'
32
27
  widgets:
33
- # Recent update
34
- recent:
35
- layout: recent
36
- rss: # /atom.xml # npm i hexo-generator-feed
37
- limit: 5 # Count of posts
38
- # TOC (valid only in layout:post/wiki)
39
- toc:
40
- layout: toc
41
- list_number: false
42
- min_depth: 2
43
- max_depth: 5
44
- fallback: recent # Use a backup widget when toc does not exist.
45
- # github user info
46
- ghuser:
47
- layout: ghuser
48
- api: https://api.github.com
49
- username: github # your github login username
50
- avatar: true
51
- ghuser_mini:
52
- layout: ghuser
53
- header: # GitHub Info
54
- api: https://api.github.com
55
- username: github # your github login username
56
- avatar: false
57
- # welcome
58
- welcome:
59
- layout: markdown
60
- title: Stellar 入门指南
61
- content: | # support markdown
62
- 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
63
- <br>
64
- **第一步**
65
- 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
66
- <br>
67
- **第二步**
68
- 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
69
- <br>
70
- 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
71
-
28
+ index: [welcome, recent, timeline] # for home/wiki/categories/tags/archives/404 pages
29
+ page: [welcome, toc] # for pages using 'layout:page'
30
+ post: [toc, ghrepo, ghissues] # for pages using 'layout:post'
31
+ wiki: [toc, ghrepo, ghissues, related] # for pages using 'layout:wiki'
72
32
 
73
33
 
74
34
  ######## Main ########
@@ -95,7 +55,6 @@ article:
95
55
  related_posts:
96
56
  enable: false
97
57
  max_count: 5
98
- auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
99
58
 
100
59
 
101
60
  ######## Comments ########
@@ -260,10 +219,10 @@ tag_plugins:
260
219
  # {% quot %}
261
220
  quot:
262
221
  default: # 可以自行配置多种图标方案
263
- prefix: https://s2.loli.net/2022/01/04/vsTB5pGrIHfPxSj.png
264
- suffix: https://s2.loli.net/2022/01/04/NORdtjlAhifZSns.png
222
+ prefix: https://bu.dusays.com/2022/10/24/63567d3e092ff.png
223
+ suffix: https://bu.dusays.com/2022/10/24/63567d3e0ab55.png
265
224
  hashtag:
266
- prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
225
+ prefix: https://bu.dusays.com/2022/10/24/63567d3e07da3.png
267
226
  # {% emoji %}
268
227
  emoji:
269
228
  default: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
@@ -291,7 +250,7 @@ plugins:
291
250
  friends: /js/plugins/friends.js
292
251
  ghinfo: /js/plugins/ghinfo.js
293
252
  timeline: /js/plugins/timeline.js
294
-
253
+ linkcard: /js/plugins/linkcard.js
295
254
 
296
255
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
297
256
 
@@ -365,19 +324,43 @@ plugins:
365
324
  style:
366
325
  darkmode: auto # auto / always / false
367
326
  smooth_scroll: true # true / false
327
+ font-size: 16px
368
328
  font-family:
369
- logo: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
370
- body: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
371
- code: Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif
372
- theme:
373
- light: '#f8f8f8'
374
- dark: '#313438'
329
+ logo: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
330
+ body: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
331
+ code: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
332
+ text-align: left
333
+ color:
334
+ common:
335
+ theme: '#1BCDFC' # 主题色
336
+ accent: '#ff5722' # 强调色
337
+ link: '#2196f3' # 超链接颜色
338
+ button: '#1BCDFC' # 按钮颜色
339
+ hover: '#ff5722' # 按钮高亮颜色
340
+ light:
341
+ background: '#f8f8f8' # 浅色背景颜色
342
+ block: '#f2f2f2' # 块背景颜色
343
+ card: white # 卡片背景颜色
344
+ title: '#000' # 标题文本颜色
345
+ text: '#333' # 正文文本颜色
346
+ code: '#111' # 行内代码颜色
347
+ dark:
348
+ background: '#313438' # 深色背景颜色
349
+ background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
350
+ block: '#2B2F33' # 块背景颜色
351
+ card: '#464D57' # 卡片背景颜色
352
+ title: '#fff' # 标题文本颜色
353
+ text: '#eee' # 正文文本颜色
354
+ code: '#ff7043' # 行内代码颜色
375
355
  animated_avatar:
376
356
  animate: auto # auto, always
377
357
  background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
378
358
  codeblock:
379
359
  scrollbar: 4px
380
360
  highlightjs_theme: https://fastly.jsdelivr.net/gh/highlightjs/cdn-release@11.5.0/build/styles/atom-one-dark.min.css
361
+ loading:
362
+ loading: 正在加载
363
+ error: 加载失败,请稍后重试。
381
364
 
382
365
  default:
383
366
  avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
@@ -0,0 +1,70 @@
1
+ # 您可以在这里创建属于自己的侧边栏组件库,在需要的位置放置自己的组件
2
+ # layout即组件布局,支持自定义的有:
3
+ # - markdown: 渲染 md 文本
4
+ #
5
+
6
+ ghrepo:
7
+ layout: ghrepo
8
+ related:
9
+ layout: related
10
+
11
+ ghissues:
12
+ layout: ghissues
13
+ title: # Recent Issues
14
+ limit: 3 # 显示的issues最大数量
15
+ labels: # 过滤只显示具有某些标签的issues
16
+
17
+ # 将其覆盖设置为空,可删除一个默认组件,例如 welcome:
18
+ # Recent update
19
+ recent:
20
+ layout: recent
21
+ rss: # /atom.xml # npm i hexo-generator-feed
22
+ limit: 5 # Count of posts
23
+ # TOC (valid only in layout:post/wiki)
24
+ toc:
25
+ layout: toc
26
+ list_number: false
27
+ min_depth: 2
28
+ max_depth: 5
29
+ fallback: recent # Use a backup widget when toc does not exist.
30
+ # github user info
31
+ ghuser:
32
+ layout: ghuser
33
+ api: https://api.github.com
34
+ username: github # your github login username
35
+ avatar: true # show avatar or not
36
+ menu: true # show menu or not
37
+
38
+ tagcloud:
39
+ layout: tagcloud
40
+ title: 标签云
41
+ # 标签云配置
42
+ min_font: 12
43
+ max_font: 24
44
+ amount: 100
45
+ orderby: name
46
+ order: 1 # 1, sac 升序;-1, desc 降序
47
+ color: false # 使用颜色
48
+ start_color: # 开始的颜色。您可使用十六进位值(#b700ff),rgba(rgba(183, 0, 255, 1)),hsla(hsla(283, 100%, 50%, 1))或 颜色关键字。此变量仅在 color 参数开启时才有用。
49
+ end_color: # 结束的颜色。您可使用十六进位值(#b700ff),rgba(rgba(183, 0, 255, 1)),hsla(hsla(283, 100%, 50%, 1))或 颜色关键字。此变量仅在 color 参数开启时才有用。
50
+ show_count: false # 显示每个标签的文章总数
51
+
52
+ welcome:
53
+ layout: markdown
54
+ title: Stellar 入门指南
55
+ content: | # support markdown
56
+ 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
57
+ <br>
58
+ **第一步**
59
+ 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
60
+ <br>
61
+ **第二步**
62
+ 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
63
+ <br>
64
+ 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
65
+
66
+ timeline:
67
+ layout: timeline
68
+ title: 近期动态
69
+ api: https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues
70
+ user:
package/languages/en.yml CHANGED
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 'Updated on'
29
29
  license: License
30
30
  share: Share
31
- repo_info: Repo Info
32
31
  date_suffix:
33
32
  just: Just
34
33
  min: minutes ago
@@ -15,10 +15,10 @@ meta:
15
15
  recent_update: 最近更新
16
16
  toc: 本文目录
17
17
  read_next: 接下来阅读
18
- prev: 上一篇
19
- next: 下一篇
20
- older: 较早
21
- newer: 较新
18
+ prev: 回顾上一篇
19
+ next: 接下来阅读
20
+ older: 较早文章
21
+ newer: 较新文章
22
22
  references: 参考资料
23
23
  related_posts: 您可能感兴趣的文章
24
24
  comment_title: 快来参与讨论吧
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 更新于
29
29
  license: 许可协议
30
30
  share: 分享文章
31
- repo_info: 项目仓库
32
31
  date_suffix:
33
32
  just: 刚刚
34
33
  min: 分钟前
@@ -15,10 +15,10 @@ meta:
15
15
  recent_update: 最近更新
16
16
  toc: 本文目錄
17
17
  read_next: 接下來閱讀
18
- prev: 上一篇
19
- next: 下一篇
20
- older: 較早
21
- newer: 較新
18
+ prev: 回顧上一篇
19
+ next: 接下來閱讀
20
+ older: 較早文章
21
+ newer: 較新文章
22
22
  references: 參考資料
23
23
  related_posts: 您可能感興趣的文章
24
24
  comment_title: 參與討論
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 更新於
29
29
  license: 授權條款
30
30
  share: 分享文章
31
- repo_info: 專案儲存庫
32
31
  date_suffix:
33
32
  just: 剛剛
34
33
  min: 分鐘前
@@ -25,31 +25,30 @@ function layoutDiv() {
25
25
  }
26
26
  });
27
27
  }
28
- if (next == undefined) {
29
- // 项目的最后一篇文档
30
- return '<br>';
31
- }
32
28
  }
33
29
  let el = '';
34
30
  if (prev || next) {
35
31
  el += '<div class="related-wrap reveal" id="read-next">';
36
- el += '<section class="header cap theme">';
37
- el += '<span>' + title + '</span>';
38
- el += '</section>';
39
- el += '<section class="body fs14">';
40
- if (next) {
41
- el += '<a id="next" href="' + url_for(next.path) + '">';
42
- el += next.title || next.seo_title || next.wiki;
43
- el += '<span class="note">' + title_next + '</span>';
44
- el += '</a>';
45
- }
46
- el += '<div class="line"></div>';
32
+ el += '<section class="body">';
33
+ // prev
34
+ el += '<div class="item" id="prev">';
47
35
  if (prev) {
48
- el += '<a id="prev" href="' + url_for(prev.path) + '">';
36
+ el += '<div class="note">' + title_prev + '</div>';
37
+ el += '<a href="' + url_for(prev.path) + '">';
49
38
  el += prev.title || prev.seo_title || prev.wiki;
50
- el += '<span class="note">' + title_prev + '</span>';
51
39
  el += '</a>';
52
40
  }
41
+ el += '</div>';
42
+ // next
43
+ el += '<div class="item" id="next">';
44
+ if (next) {
45
+ el += '<div class="note">' + title_next + '</div>';
46
+ el += '<a href="' + url_for(next.path) + '">';
47
+ el += next.title || next.seo_title || next.wiki;
48
+ el += '</a>';
49
+ }
50
+ el += '</div>';
51
+
53
52
  el += '</section>';
54
53
  el += '</div>';
55
54
  }
@@ -62,7 +62,7 @@ function layoutDiv() {
62
62
  let url_proj = url_for(proj.homepage.path);
63
63
  if (nodes.includes(url_proj) === false) {
64
64
  el += '<span class="sep"></span>';
65
- el += '<a class="cap breadcrumb" id="proj" href="' + url_proj + '">' + proj.title + '</a>';
65
+ el += '<a class="cap breadcrumb" id="proj" href="' + url_proj + '">' + (proj.name || proj.title) + '</a>';
66
66
  }
67
67
  el += '</div>';
68
68
  // 更新日期
@@ -1,9 +1,9 @@
1
1
  <div class='nav-wrap'>
2
2
  <nav class='sub post cap'>
3
3
  <% if (is_home()) { %>
4
- <a class='active' href='/'><%- __('btn.recent_publish') %></a>
4
+ <a class='active' href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
5
5
  <% } else { %>
6
- <a href='/'><%- __('btn.recent_publish') %></a>
6
+ <a href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
7
7
  <% } %>
8
8
  <% if (site.categories && site.categories.length > 0) { %>
9
9
  <% if (page.category) { %>
@@ -1,16 +1,22 @@
1
1
  <%
2
+ const obj = {
3
+ image: post['cover'],
4
+ title: post['cover-title'],
5
+ cat: post['cover-cat'],
6
+ subtitle: post['cover-subtitle']
7
+ };
2
8
  function div_default() {
3
9
  var el = '';
4
10
  el += '<article class="md">';
5
11
 
6
12
  // 封面
7
- if (post.cover || theme.article.auto_cover) {
13
+ if (obj.image || theme.article.auto_cover) {
8
14
  var cover_url;
9
- if (post.cover != undefined) {
10
- if (post.cover.includes('/')) {
11
- cover_url = post.cover;
15
+ if (obj.image != undefined) {
16
+ if (obj.image.includes('/')) {
17
+ cover_url = obj.image;
12
18
  } else {
13
- cover_url = 'https://source.unsplash.com/1280x640/?' + post.cover;
19
+ cover_url = 'https://source.unsplash.com/1280x640/?' + obj.image;
14
20
  }
15
21
  } else {
16
22
  // 自动以 tags 作为关键词搜索封面
@@ -89,22 +95,22 @@ function div_default() {
89
95
  function div_photo() {
90
96
  var el = '';
91
97
  el += '<div class="cover">';
92
- el += '<img src="' + post.cover + '"/>';
93
- if (post.cover_info) {
98
+ el += '<img src="' + obj.image + '"/>';
99
+ if (obj.title || obj.cat || obj.subtitle) {
94
100
  el += '<div class="cover-info"';
95
- if (post.cover_info.meta) {
101
+ if (obj.cat) {
96
102
  el += 'position="top">';
97
103
  } else {
98
104
  el += 'position="bottom">';
99
105
  }
100
- if (post.cover_info.meta) {
101
- el += '<div class="cap">' + post.cover_info.meta + '</div>';
106
+ if (obj.cat) {
107
+ el += '<div class="cap">' + obj.cat + '</div>';
102
108
  }
103
- if (post.cover_info.title) {
104
- el += '<div class="title">' + post.cover_info.title + '</div>';
109
+ if (obj.title) {
110
+ el += '<div class="title">' + obj.title + '</div>';
105
111
  }
106
- if (post.cover_info.subtitle) {
107
- el += '<div class="cap">' + post.cover_info.subtitle + '</div>';
112
+ if (obj.subtitle) {
113
+ el += '<div class="cap">' + obj.subtitle + '</div>';
108
114
  }
109
115
  el += '</div>';
110
116
 
@@ -113,7 +119,7 @@ function div_photo() {
113
119
  return el;
114
120
  }
115
121
  function div() {
116
- if (post.cover && post.cover.length > 0 && post.cover_info != undefined) {
122
+ if (obj.image && obj.image.length > 0 && obj.title != undefined) {
117
123
  return div_photo();
118
124
  }
119
125
  return div_default();
@@ -16,7 +16,7 @@ function layoutDiv() {
16
16
  let tag = proj.tags[0];
17
17
  el += '<div class="cap breadcrumb"' + category_color(tag) + '>' + tag + '</div>';
18
18
  }
19
- el += '<h2 class="post-title">' + (proj.wiki || proj.title || proj.seo_title) + '</h2>';
19
+ el += '<h2 class="post-title">' + (proj.title || proj.name || proj.seo_title) + '</h2>';
20
20
  if (proj.description) {
21
21
  el += '<p>' + proj.description + '</p>';
22
22
  }
@@ -1,27 +1,4 @@
1
1
  <%
2
- function layoutMenu() {
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;
13
- }
14
- el += '<a class="nav-item';
15
- if (id == page.menu_id) {
16
- el += ' active';
17
- }
18
- el += '" href="' + url_for(md_link(item)) + '">';
19
- el += __(md_text(item));
20
- el += '</a>';
21
- }
22
- el += '</nav>';
23
- return el;
24
- }
25
2
  function layoutDiv() {
26
3
  var el = '';
27
4
  el += '<header class="header';
@@ -33,13 +10,12 @@ function layoutDiv() {
33
10
  if (where != 'main') {
34
11
  if (page.layout === 'wiki' && page.wiki) {
35
12
  if (page.menu_id !== 'wiki') {
36
- el += layoutMenu();
13
+ el += partial('menu', {where: where});
37
14
  }
38
15
  } else {
39
- el += layoutMenu();
16
+ el += partial('menu', {where: where});
40
17
  }
41
18
  }
42
-
43
19
  el += '</header>';
44
20
  return el;
45
21
  }
@@ -2,18 +2,18 @@
2
2
  // 默认组件
3
3
  if (page.sidebar == undefined) {
4
4
  if (page.layout == 'post' && page.content) {
5
- page.sidebar = theme.sidebar.widget_layout.post;
5
+ page.sidebar = theme.sidebar.widgets.post;
6
6
  } else if (page.layout == 'wiki' && page.content && page.wiki) {
7
7
  let proj = theme.wiki.projects[page.wiki];
8
8
  if (proj.sidebar) {
9
9
  page.sidebar = proj.sidebar;
10
10
  } else {
11
- page.sidebar = theme.sidebar.widget_layout.wiki;
11
+ page.sidebar = theme.sidebar.widgets.wiki;
12
12
  }
13
13
  } else if (is_home() || ['categories', 'tags', 'archives', 'index', '404', undefined].includes(page.layout)) {
14
- page.sidebar = theme.sidebar.widget_layout.index;
14
+ page.sidebar = theme.sidebar.widgets.index;
15
15
  } else if (page.layout == 'page') {
16
- page.sidebar = theme.sidebar.widget_layout.page;
16
+ page.sidebar = theme.sidebar.widgets.page;
17
17
  } else {
18
18
  page.sidebar = [];
19
19
  }
@@ -23,8 +23,8 @@ function layoutWidgets() {
23
23
  el += '<div class="widgets">';
24
24
  if (page.sidebar) {
25
25
  page.sidebar.forEach((w, i) => {
26
- if (w in theme.sidebar.widgets) {
27
- let widget = theme.sidebar.widgets[w];
26
+ if (w in theme.data.widgets) {
27
+ let widget = theme.data.widgets[w];
28
28
  if (widget && widget.layout) {
29
29
  el += partial('widgets/' + widget.layout, {item: widget});
30
30
  }
@@ -6,7 +6,7 @@ if (page.layout === 'wiki' && page.wiki) {
6
6
  function layoutTitle(main, url, sub) {
7
7
  var el = '';
8
8
  el += '<a class="title" href="' + url_for(url || "/") + '">';
9
- el += '<div class="main">' + main + '</div>';
9
+ el += '<div class="main" ff="title">' + main + '</div>';
10
10
  if (sub) {
11
11
  let arr = sub.split('|');
12
12
  if (arr.length > 1) {
@@ -21,7 +21,7 @@ function layoutTitle(main, url, sub) {
21
21
  }
22
22
  function layoutDiv() {
23
23
  var el = '';
24
- if (page.layout == 'wiki' && proj && proj.index != false) {
24
+ if (page.layout == 'wiki') {
25
25
  el += '<div class="logo-wrap wiki">';
26
26
  // all products
27
27
  el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(config.wiki_dir) + '">';
@@ -39,7 +39,7 @@ function layoutDiv() {
39
39
  }
40
40
  }
41
41
  if (proj != undefined) {
42
- let main = proj.title || proj.wiki || page.wiki || page.title;
42
+ let main = proj.name || proj.title || proj.wiki || page.wiki || page.title;
43
43
  let url = proj.homepage.path;
44
44
  let sub = proj.subtitle;
45
45
  el += layoutTitle(main, url, sub);
@@ -0,0 +1,27 @@
1
+ <%
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;
13
+ }
14
+ el += '<a class="nav-item';
15
+ if (id == page.menu_id) {
16
+ el += ' active';
17
+ }
18
+ el += '" href="' + url_for(md_link(item)) + '">';
19
+ el += __(md_text(item));
20
+ el += '</a>';
21
+ }
22
+ el += '</nav>';
23
+ return el;
24
+ }
25
+ %>
26
+
27
+ <%- layoutDiv() %>
@@ -0,0 +1,46 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ var repo;
5
+ var branch = 'main';
6
+ if (page.layout === 'wiki' && page.wiki) {
7
+ let proj = theme.wiki.projects[page.wiki];
8
+ if (proj && proj.repo) {
9
+ repo = proj.repo;
10
+ if (proj.branch != undefined) {
11
+ branch = proj.branch;
12
+ }
13
+ }
14
+ } else {
15
+ // 其它的如果有设置 repo 也可以
16
+ repo = page.repo;
17
+ }
18
+ if (repo == undefined) {
19
+ return el;
20
+ }
21
+ item.api = 'https://api.github.com/repos/' + repo + '/issues?per_page=' + item.limit;
22
+ if (item.labels) {
23
+ item.api += '&labels=' + item.labels;
24
+ }
25
+ console.log(item.api);
26
+ el += '<div class="widget-wrap" id="timeline">';
27
+ if (item.title) {
28
+ el += '<div class="widget-header cap theme dis-select">';
29
+ el += '<span class="name">' + item.title + '</span>';
30
+ el += '</div>';
31
+ }
32
+ el += '<div class="widget-body fs14">';
33
+ el += '<div class="tag-plugin timeline stellar-timeline-api"';
34
+ ['api', 'user'].forEach(key => {
35
+ if (item[key]) {
36
+ el += ' ' + key + '="' + item[key] + '"';
37
+ }
38
+ });
39
+ el += '>';
40
+ el += '</div>';
41
+ el += '</div>';
42
+ el += '</div>';
43
+ return el;
44
+ }
45
+ %>
46
+ <%- layoutDiv() %>
@@ -0,0 +1,53 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ var repo;
5
+ var branch = 'main';
6
+ if (page.layout === 'wiki' && page.wiki) {
7
+ let proj = theme.wiki.projects[page.wiki];
8
+ if (proj && proj.repo) {
9
+ repo = proj.repo;
10
+ if (proj.branch != undefined) {
11
+ branch = proj.branch;
12
+ }
13
+ }
14
+ } else {
15
+ // 其它的如果有设置 repo 也可以
16
+ repo = page.repo;
17
+ }
18
+ if (repo == undefined) {
19
+ return el;
20
+ }
21
+ // 布局
22
+ el += '<div class="widget-wrap" id="repo-info">';
23
+ // body
24
+ el += '<div class="widget-body">';
25
+ el += '<div class="items stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '">';
26
+ el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
27
+ el += '<div class="repo-name flex-row">';
28
+ 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>';
29
+ el += repo;
30
+ el += '</div>';
31
+ el += '<div class="repo-desc"><span type="text" id="description">&nbsp;</span></div>';
32
+ el += '<div class="grid">';
33
+ el += '<div class="flex-row">';
34
+ 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>';
35
+ el += '<span type="text" id="stargazers_count"></span>';
36
+ el += '</div>';
37
+ el += '<div class="flex-row">';
38
+ 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>';
39
+ el += '<span type="text" id="forks_count"></span>';
40
+ el += '</div>';
41
+ el += '<div class="flex-row stellar-ghinfo-api" index="0" api="https://api.github.xaoxuu.com/repos/' + repo + '/tags">';
42
+ 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>';
43
+ el += '<span type="text" id="latest-tag-name">0</span>';
44
+ el += '</div>';
45
+ el += '</div>';
46
+ el += '</a>';
47
+ el += '</div>';
48
+ el += '</div>';
49
+ el += '</div>';
50
+ return el;
51
+ }
52
+ %>
53
+ <%- layoutDiv() %>