hexo-theme-stellar 1.11.0 → 1.13.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 (78) hide show
  1. package/README.md +7 -7
  2. package/_config.yml +22 -37
  3. package/_data/links.yml +7 -0
  4. package/_data/widgets.yml +30 -6
  5. package/languages/zh-CN.yml +4 -4
  6. package/languages/zh-TW.yml +4 -4
  7. package/layout/_partial/head.ejs +2 -0
  8. package/layout/_partial/main/article/read_next.ejs +16 -17
  9. package/layout/_partial/main/navbar/breadcrumb.ejs +1 -1
  10. package/layout/_partial/main/navbar/list_post.ejs +57 -34
  11. package/layout/_partial/main/post_list/post_card.ejs +25 -15
  12. package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
  13. package/layout/_partial/scripts/index.ejs +1 -0
  14. package/layout/_partial/sidebar/header.ejs +2 -26
  15. package/layout/_partial/sidebar/logo.ejs +2 -2
  16. package/layout/_partial/sidebar/menu.ejs +27 -0
  17. package/layout/_partial/sidebar/widgets/ghissues.ejs +45 -0
  18. package/layout/_partial/sidebar/widgets/ghrepo.ejs +3 -3
  19. package/layout/_partial/sidebar/widgets/ghuser.ejs +4 -0
  20. package/layout/_partial/sidebar/widgets/markdown.ejs +1 -1
  21. package/layout/_partial/sidebar/widgets/recent.ejs +8 -11
  22. package/layout/_partial/sidebar/widgets/{wiki_more.ejs → related.ejs} +7 -7
  23. package/layout/_partial/sidebar/widgets/tagcloud.ejs +24 -0
  24. package/layout/_partial/sidebar/widgets/timeline.ejs +27 -0
  25. package/layout/_partial/sidebar/widgets/toc.ejs +1 -5
  26. package/layout/index.ejs +1 -1
  27. package/layout/page.ejs +19 -10
  28. package/package.json +1 -1
  29. package/scripts/events/lib/config.js +1 -1
  30. package/scripts/events/lib/doc_tree.js +3 -0
  31. package/scripts/helpers/related_posts.js +11 -39
  32. package/scripts/tags/about.js +10 -7
  33. package/scripts/tags/{grid.js → border.js} +4 -4
  34. package/scripts/tags/friends.js +36 -75
  35. package/scripts/tags/link.js +11 -9
  36. package/scripts/tags/navbar.js +1 -1
  37. package/scripts/tags/sites.js +40 -79
  38. package/scripts/tags/split.js +51 -0
  39. package/scripts/tags/timeline.js +6 -4
  40. package/source/css/_common/base.styl +2 -2
  41. package/source/css/_common/blur.styl +3 -0
  42. package/source/css/_common/device.styl +2 -0
  43. package/source/css/_common/highlight.styl +1 -1
  44. package/source/css/_common/loading.styl +16 -3
  45. package/source/css/_common/title.styl +0 -13
  46. package/source/css/_custom.styl +4 -4
  47. package/source/css/_layout/list.styl +40 -12
  48. package/source/css/_layout/main.styl +1 -1
  49. package/source/css/_layout/md.styl +1 -4
  50. package/source/css/_layout/partial/navbar.styl +1 -1
  51. package/source/css/_layout/partial/related.styl +62 -93
  52. package/source/css/_layout/sidebar/footer.styl +4 -2
  53. package/source/css/_layout/sidebar/ghrepo.styl +11 -5
  54. package/source/css/_layout/sidebar/ghuser.styl +19 -1
  55. package/source/css/_layout/sidebar/sidebar.styl +11 -96
  56. package/source/css/_layout/sidebar/toc_common.styl +5 -3
  57. package/source/css/_layout/sidebar/widgets.styl +103 -0
  58. package/source/css/_layout/tag-plugins/about.styl +21 -18
  59. package/source/css/_layout/tag-plugins/common.styl +36 -31
  60. package/source/css/_layout/tag-plugins/link.styl +41 -27
  61. package/source/css/_layout/tag-plugins/navbar.styl +10 -4
  62. package/source/css/_layout/tag-plugins/quot.styl +1 -1
  63. package/source/css/_layout/tag-plugins/split.styl +32 -0
  64. package/source/css/_layout/tag-plugins/timeline.styl +40 -14
  65. package/source/css/_plugins/comments/twikoo.styl +11 -5
  66. package/source/css/_plugins/comments/waline.styl +5 -1
  67. package/source/css/_plugins/index.styl +0 -2
  68. package/source/js/main.js +15 -9
  69. package/source/js/plugins/fcircle.js +92 -0
  70. package/source/js/plugins/friends.js +3 -2
  71. package/source/js/plugins/ghinfo.js +14 -2
  72. package/source/js/plugins/linkcard.js +124 -0
  73. package/source/js/plugins/sites.js +4 -3
  74. package/source/js/plugins/timeline.js +58 -40
  75. package/layout/_partial/plugins/comments/valine/layout.ejs +0 -19
  76. package/layout/_partial/plugins/comments/valine/script.ejs +0 -48
  77. package/scripts/tags/issues.js +0 -30
  78. package/source/css/_plugins/comments/valine.styl +0 -218
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # hexo-theme-stellar
1
+ # Stellar - 每个人的独立博客
2
2
 
3
- Elegant and powerful theme for Hexo.
3
+ Stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富的标签和动态数据组件,请配合 [文档](https://xaoxuu.com/wiki/stellar/) 使用。
4
4
 
5
5
  ## Getting Started
6
6
 
7
7
  Check your environment:
8
8
 
9
9
  ```yaml
10
- Hexo: 5.4.0
11
- hexo-cli: 4.3.0
12
- node.js: 14.17.3 LTS
13
- npm: 6.14.13 LTS
10
+ Hexo: 5.4.0 ~ 6.3.0
11
+ hexo-cli: 4.3.0 ~ latest
12
+ node.js: 14.17.3 ~ 18.12.0
13
+ npm: 6.14.13 ~ 8.19.2
14
14
  ```
15
15
 
16
16
  Edit your `_config.yml`:
@@ -31,7 +31,7 @@ See docs: https://xaoxuu.com/wiki/stellar/
31
31
 
32
32
  ## Examples
33
33
 
34
- https://xaoxuu.com
34
+ https://xaoxuu.com/wiki/stellar/examples/
35
35
 
36
36
  ## Feedback
37
37
 
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.11.0'
3
+ version: '1.13.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
@@ -25,10 +25,14 @@ sidebar:
25
25
  # about: '[关于](/about/)'
26
26
  # Sidebar widgets
27
27
  widgets:
28
- index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
28
+ index: [welcome, recent, timeline] # for home/wiki/categories/tags/archives/404 pages
29
29
  page: [welcome, toc] # for pages using 'layout:page'
30
- post: [toc, ghrepo] # for pages using 'layout:post'
31
- wiki: [ghrepo, toc, wiki_more] # for pages using 'layout:wiki'
30
+ post: [toc, ghrepo, ghissues] # for pages using 'layout:post'
31
+ wiki: [toc, ghrepo, ghissues, related] # for pages using 'layout:wiki'
32
+
33
+ ######## Index ########
34
+ post-index: # 近期发布 分类 标签 归档 and ...
35
+ # '朋友文章': /friends/rss/
32
36
 
33
37
 
34
38
  ######## Main ########
@@ -55,12 +59,11 @@ article:
55
59
  related_posts:
56
60
  enable: false
57
61
  max_count: 5
58
- auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
59
62
 
60
63
 
61
64
  ######## Comments ########
62
65
  comments:
63
- service: # beaudar, utterances, valine, twikoo, waline
66
+ service: # beaudar, utterances, twikoo, waline
64
67
  # beaudar
65
68
  # https://beaudar.lipk.org/
66
69
  beaudar:
@@ -99,28 +102,6 @@ comments:
99
102
  data-loading: lazy
100
103
  crossorigin: anonymous
101
104
 
102
- valine:
103
- js: https://fastly.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
104
- appId: # your appId
105
- appKey: # your appKey
106
- placeholder:
107
- requiredFields: [nick, mail]
108
- enableQQ: true # Unstable avatar link
109
- recordIP: false # Record commenter IP
110
- avatar: robohash # gravatar style https://valine.js.org/avatar
111
- pageSize: 10 # comment list page size
112
- lang: zh-cn
113
- highlight: true
114
- mathJax: false
115
- tagMeta: [博主, 小伙伴, 访客] # 标签要显示的文字,默认'博主,小伙伴,访客'
116
- metaPlaceholder:
117
- nick: "昵称/QQ号(必填)"
118
- mail: "邮箱(必填,完全保密)"
119
- link: "网址(https://)"
120
- master: #md5加密后的博主邮箱
121
- - 6783037F2DF30EAB99F9FC256157D875
122
- friends: #md5加密后的小伙伴邮箱
123
- - 6783037F2DF30EAB99F9FC256157D875
124
105
  # Twikoo
125
106
  # https://twikoo.js.org/
126
107
  twikoo:
@@ -220,10 +201,10 @@ tag_plugins:
220
201
  # {% quot %}
221
202
  quot:
222
203
  default: # 可以自行配置多种图标方案
223
- prefix: https://s2.loli.net/2022/01/04/vsTB5pGrIHfPxSj.png
224
- suffix: https://s2.loli.net/2022/01/04/NORdtjlAhifZSns.png
204
+ prefix: https://bu.dusays.com/2022/10/24/63567d3e092ff.png
205
+ suffix: https://bu.dusays.com/2022/10/24/63567d3e0ab55.png
225
206
  hashtag:
226
- prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
207
+ prefix: https://bu.dusays.com/2022/10/24/63567d3e07da3.png
227
208
  # {% emoji %}
228
209
  emoji:
229
210
  default: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
@@ -251,10 +232,11 @@ plugins:
251
232
  friends: /js/plugins/friends.js
252
233
  ghinfo: /js/plugins/ghinfo.js
253
234
  timeline: /js/plugins/timeline.js
254
-
235
+ linkcard: /js/plugins/linkcard.js
236
+ fcircle: /js/plugins/fcircle.js
255
237
 
256
238
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
257
-
239
+
258
240
  ## optional plugins ##
259
241
  # preload
260
242
  preload:
@@ -286,7 +268,6 @@ plugins:
286
268
  js: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js
287
269
  css: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css
288
270
  # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
289
- # 使用valine评论可以写: .vcontent img:not(.vemoji)
290
271
  # 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
291
272
  # 使用waline评论可以写: #waline_container .vcontent img
292
273
  selector: .swiper-slide img # 多个选择器用英文逗号隔开
@@ -327,9 +308,10 @@ style:
327
308
  smooth_scroll: true # true / false
328
309
  font-size: 16px
329
310
  font-family:
330
- logo: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
331
- body: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
332
- code: Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif
311
+ logo: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
312
+ body: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
313
+ code: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
314
+ text-align: left
333
315
  color:
334
316
  common:
335
317
  theme: '#1BCDFC' # 主题色
@@ -358,6 +340,9 @@ style:
358
340
  codeblock:
359
341
  scrollbar: 4px
360
342
  highlightjs_theme: https://fastly.jsdelivr.net/gh/highlightjs/cdn-release@11.5.0/build/styles/atom-one-dark.min.css
343
+ loading:
344
+ loading: 正在加载
345
+ error: 加载失败,请稍后重试。
361
346
 
362
347
  default:
363
348
  avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
@@ -0,0 +1,7 @@
1
+
2
+ '示例':
3
+ - title: XAOXUU
4
+ avatar: https://bu.dusays.com/2021/09/24/2f74810ceb3d3.png
5
+ url: https://xaoxuu.com
6
+ screenshot: https://bu.dusays.com/2022/10/23/63542895cfd29.png
7
+ description:
package/_data/widgets.yml CHANGED
@@ -3,13 +3,17 @@
3
3
  # - markdown: 渲染 md 文本
4
4
  #
5
5
 
6
- # ---- 内置组件,暂时不支持覆盖 ----
7
6
  ghrepo:
8
7
  layout: ghrepo
9
- wiki_more:
10
- layout: wiki_more
8
+ related:
9
+ layout: related
10
+
11
+ ghissues:
12
+ layout: ghissues
13
+ title: # Recent Issues
14
+ limit: 3 # 显示的issues最大数量
15
+ labels: # 过滤只显示具有某些标签的issues
11
16
 
12
- # ---- 默认组件,可以覆盖自定义配置 ----
13
17
  # 将其覆盖设置为空,可删除一个默认组件,例如 welcome:
14
18
  # Recent update
15
19
  recent:
@@ -28,8 +32,22 @@ ghuser:
28
32
  layout: ghuser
29
33
  api: https://api.github.com
30
34
  username: github # your github login username
31
- avatar: true # true / false
35
+ avatar: true # show avatar or not
36
+ menu: true # show menu or not
32
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 # 显示每个标签的文章总数
33
51
 
34
52
  welcome:
35
53
  layout: markdown
@@ -43,4 +61,10 @@ welcome:
43
61
  **第二步**
44
62
  创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
45
63
  <br>
46
- 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
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:
@@ -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: 快来参与讨论吧
@@ -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: 參與討論
@@ -45,6 +45,7 @@ function og_args() {
45
45
  %>
46
46
  <head>
47
47
  <%- meta_generator() %>
48
+ <meta name="hexo-theme" content="<%- stellar_info('tree') %>">
48
49
  <meta charset="utf-8">
49
50
  <%- generate_robots() %>
50
51
 
@@ -60,6 +61,7 @@ function og_args() {
60
61
  <meta name="apple-mobile-web-app-capable" content="yes">
61
62
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
62
63
  <meta name="theme-color" content="#f8f8f8">
64
+
63
65
  <title><%- generate_title() %></title>
64
66
 
65
67
  <% if (theme.open_graph && theme.open_graph.enable) { %>
@@ -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,34 +1,57 @@
1
- <div class='nav-wrap'>
2
- <nav class='sub post cap'>
3
- <% if (is_home()) { %>
4
- <a class='active' href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
5
- <% } else { %>
6
- <a href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
7
- <% } %>
8
- <% if (site.categories && site.categories.length > 0) { %>
9
- <% if (page.category) { %>
10
- <a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.category') + __('symbol.colon') + page.category %></a>
11
- <% } else if (page.layout == 'categories') { %>
12
- <a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
13
- <% } else { %>
14
- <a href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
15
- <% } %>
16
- <% } %>
17
- <% if (site.tags && site.tags.length > 0) { %>
18
- <% if (page.tag) { %>
19
- <a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tag') + __('symbol.colon') + page.tag %></a>
20
- <% } else if (page.layout == 'tags') { %>
21
- <a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
22
- <% } else { %>
23
- <a href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
24
- <% } %>
25
- <% } %>
26
- <% if (site.posts && site.posts.length > 0) { %>
27
- <% if (is_archive()) { %>
28
- <a class='active' href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
29
- <% } else { %>
30
- <a href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
31
- <% } %>
32
- <% } %>
33
- </nav>
34
- </div>
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ el += '<div class="nav-wrap">';
5
+ el += '<nav class="sub post cap">';
6
+ if (is_home()) {
7
+ el += '<a class="active" href="' + url_for("/") + '">' + __("btn.recent_publish") + '</a>';
8
+ } else {
9
+ el += '<a href="' + url_for("/") + '">' + __("btn.recent_publish") + '</a>';
10
+ }
11
+
12
+ if (site.categories && site.categories.length > 0) {
13
+ if (page.category) {
14
+ el += '<a class="active" href="' + url_for(config.category_dir) + '">' + __("btn.category") + __("symbol.colon") + page.category + '</a>';
15
+ } else if (page.layout == "categories") {
16
+ el += '<a class="active" href="' + url_for(config.category_dir) + '">' + __("btn.categories") + '</a>';
17
+ } else {
18
+ el += '<a href="' + url_for(config.category_dir) + '">' + __("btn.categories") + '</a>';
19
+ }
20
+ }
21
+
22
+ if (site.tags && site.tags.length > 0) {
23
+ if (page.tag) {
24
+ el += '<a class="active" href="' + url_for(config.tag_dir) + '">' + __("btn.tag") + __("symbol.colon") + page.tag + '</a>';
25
+ } else if (page.layout == "tags") {
26
+ el += '<a class="active" href="' + url_for(config.tag_dir) + '">' + __("btn.tags") + '</a>';
27
+ } else {
28
+ el += '<a href="' + url_for(config.tag_dir) + '">' + __("btn.tags") + '</a>';
29
+ }
30
+ }
31
+
32
+ if (site.posts && site.posts.length > 0) {
33
+ if (is_archive()) {
34
+ el += '<a class="active" href="' + url_for(config.archive_dir) + '">' + __("btn.archives") + '</a>';
35
+ } else {
36
+ el += '<a href="' + url_for(config.archive_dir) + '">' + __("btn.archives") + '</a>';
37
+ }
38
+ }
39
+
40
+ if (theme['post-index']) {
41
+ const obj = theme['post-index'];
42
+ for (let key of Object.keys(obj)) {
43
+ if (full_url_for(page.path) == full_url_for(obj[key])) {
44
+ el += '<a class="active" href="' + url_for(obj[key]) + '">' + key + '</a>';
45
+ } else {
46
+ el += '<a href="' + url_for(obj[key]) + '">' + key + '</a>';
47
+ }
48
+ }
49
+ }
50
+
51
+ el += '</nav>';
52
+ el += '</div>';
53
+ return el;
54
+ }
55
+ %>
56
+
57
+ <%- layoutDiv() %>
@@ -1,16 +1,23 @@
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
+ color: post['cover-text-color']
8
+ };
2
9
  function div_default() {
3
10
  var el = '';
4
11
  el += '<article class="md">';
5
12
 
6
13
  // 封面
7
- if (post.cover || theme.article.auto_cover) {
14
+ if (obj.image || theme.article.auto_cover) {
8
15
  var cover_url;
9
- if (post.cover != undefined) {
10
- if (post.cover.includes('/')) {
11
- cover_url = post.cover;
16
+ if (obj.image != undefined) {
17
+ if (obj.image.includes('/')) {
18
+ cover_url = obj.image;
12
19
  } else {
13
- cover_url = 'https://source.unsplash.com/1280x640/?' + post.cover;
20
+ cover_url = 'https://source.unsplash.com/1280x640/?' + obj.image;
14
21
  }
15
22
  } else {
16
23
  // 自动以 tags 作为关键词搜索封面
@@ -89,22 +96,25 @@ function div_default() {
89
96
  function div_photo() {
90
97
  var el = '';
91
98
  el += '<div class="cover">';
92
- el += '<img src="' + post.cover + '"/>';
93
- if (post.cover_info) {
99
+ el += '<img src="' + obj.image + '"/>';
100
+ if (obj.title || obj.cat || obj.subtitle) {
94
101
  el += '<div class="cover-info"';
95
- if (post.cover_info.meta) {
102
+ if (obj.color) {
103
+ el += 'style="color:' + obj.color + '"';
104
+ }
105
+ if (obj.cat) {
96
106
  el += 'position="top">';
97
107
  } else {
98
108
  el += 'position="bottom">';
99
109
  }
100
- if (post.cover_info.meta) {
101
- el += '<div class="cap">' + post.cover_info.meta + '</div>';
110
+ if (obj.cat) {
111
+ el += '<div class="cap">' + obj.cat + '</div>';
102
112
  }
103
- if (post.cover_info.title) {
104
- el += '<div class="title">' + post.cover_info.title + '</div>';
113
+ if (obj.title) {
114
+ el += '<div class="title">' + obj.title + '</div>';
105
115
  }
106
- if (post.cover_info.subtitle) {
107
- el += '<div class="cap">' + post.cover_info.subtitle + '</div>';
116
+ if (obj.subtitle) {
117
+ el += '<div class="cap">' + obj.subtitle + '</div>';
108
118
  }
109
119
  el += '</div>';
110
120
 
@@ -113,7 +123,7 @@ function div_photo() {
113
123
  return el;
114
124
  }
115
125
  function div() {
116
- if (post.cover && post.cover.length > 0 && post.cover_info != undefined) {
126
+ if (obj.image && obj.image.length > 0 && obj.title != undefined) {
117
127
  return div_photo();
118
128
  }
119
129
  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
  }
@@ -90,6 +90,7 @@
90
90
  }
91
91
  }
92
92
  };
93
+ stellar.version = '<%- theme.stellar.version %>';
93
94
  stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
94
95
  stellar.config = {
95
96
  date_suffix: {
@@ -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
  }
@@ -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,45 @@
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
+ el += '<div class="widget-wrap" id="timeline">';
26
+ if (item.title) {
27
+ el += '<div class="widget-header cap theme dis-select">';
28
+ el += '<span class="name">' + item.title + '</span>';
29
+ el += '</div>';
30
+ }
31
+ el += '<div class="widget-body fs14">';
32
+ el += '<div class="tag-plugin timeline stellar-timeline-api"';
33
+ ['api', 'user'].forEach(key => {
34
+ if (item[key]) {
35
+ el += ' ' + key + '="' + item[key] + '"';
36
+ }
37
+ });
38
+ el += '>';
39
+ el += '</div>';
40
+ el += '</div>';
41
+ el += '</div>';
42
+ return el;
43
+ }
44
+ %>
45
+ <%- layoutDiv() %>