hexo-theme-stellar 1.9.0 → 1.11.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 (69) hide show
  1. package/_config.yml +60 -52
  2. package/_data/widgets.yml +46 -0
  3. package/languages/en.yml +0 -6
  4. package/languages/zh-CN.yml +0 -6
  5. package/languages/zh-TW.yml +0 -6
  6. package/layout/404.ejs +1 -1
  7. package/layout/_partial/main/footer.ejs +6 -17
  8. package/layout/_partial/main/header/index.ejs +1 -1
  9. package/layout/_partial/main/navbar/list_post.ejs +2 -2
  10. package/layout/_partial/plugins/comments/valine/script.ejs +1 -1
  11. package/layout/_partial/scripts/index.ejs +5 -3
  12. package/layout/_partial/sidebar/index.ejs +9 -7
  13. package/layout/_partial/sidebar/logo.ejs +1 -1
  14. package/layout/_partial/sidebar/widgets/ghrepo.ejs +53 -0
  15. package/layout/_partial/sidebar/widgets/ghuser.ejs +53 -0
  16. package/layout/_partial/sidebar/widgets/toc.ejs +1 -1
  17. package/layout/post.ejs +1 -1
  18. package/layout/wiki.ejs +1 -1
  19. package/package.json +1 -1
  20. package/scripts/events/lib/config.js +26 -10
  21. package/scripts/tags/about.js +12 -13
  22. package/scripts/tags/folders.js +55 -0
  23. package/scripts/tags/friends.js +2 -3
  24. package/scripts/tags/ghcard.js +2 -2
  25. package/scripts/tags/lib/users.js +1 -2
  26. package/scripts/tags/sites.js +2 -3
  27. package/scripts/tags/timeline.js +32 -25
  28. package/source/css/_common/base.styl +5 -9
  29. package/source/css/_common/button.styl +1 -1
  30. package/source/css/_common/device.styl +2 -2
  31. package/source/css/_common/highlight.styl +4 -3
  32. package/source/css/_common/html.styl +2 -0
  33. package/source/css/_common/loading.styl +5 -0
  34. package/source/css/_common/pre.styl +6 -0
  35. package/source/css/_custom.styl +36 -23
  36. package/source/css/_defines/const.styl +1 -0
  37. package/source/css/_defines/theme.styl +13 -13
  38. package/source/css/_layout/layout.styl +2 -2
  39. package/source/css/_layout/main.styl +2 -2
  40. package/source/css/_layout/md.styl +36 -2
  41. package/source/css/_layout/partial/footer.styl +3 -7
  42. package/source/css/_layout/partial/navbar.styl +1 -1
  43. package/source/css/_layout/partial/paginator.styl +4 -0
  44. package/source/css/_layout/partial/related.styl +2 -0
  45. package/source/css/_layout/sidebar/ghrepo.styl +30 -0
  46. package/source/css/_layout/sidebar/ghuser.styl +80 -0
  47. package/source/css/_layout/sidebar/sidebar.styl +2 -3
  48. package/source/css/_layout/tag-plugins/about.styl +14 -16
  49. package/source/css/_layout/tag-plugins/common.styl +1 -1
  50. package/source/css/_layout/tag-plugins/folders.styl +62 -0
  51. package/source/css/_layout/tag-plugins/friends.styl +3 -6
  52. package/source/css/_layout/tag-plugins/inline-labels.styl +1 -0
  53. package/source/css/_layout/tag-plugins/link.styl +2 -1
  54. package/source/css/_layout/tag-plugins/note.styl +8 -0
  55. package/source/css/_layout/tag-plugins/poetry.styl +1 -1
  56. package/source/css/_layout/tag-plugins/quot.styl +7 -6
  57. package/source/css/_layout/tag-plugins/sites.styl +2 -6
  58. package/source/css/_layout/tag-plugins/tabs.styl +5 -0
  59. package/source/css/_layout/tag-plugins/timeline.styl +108 -6
  60. package/source/css/_layout/tag-plugins/toc.styl +1 -1
  61. package/source/css/_plugins/comments/twikoo.styl +2 -2
  62. package/source/css/_plugins/comments/waline.styl +1 -1
  63. package/source/js/main.js +13 -15
  64. package/source/js/plugins/friends.js +1 -2
  65. package/source/js/plugins/ghinfo.js +73 -0
  66. package/source/js/plugins/sites.js +1 -1
  67. package/source/js/plugins/timeline.js +144 -0
  68. package/layout/_partial/sidebar/widgets/repo_info.ejs +0 -72
  69. package/source/css/_layout/sidebar/repo_info.styl +0 -28
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.9.0'
3
+ version: '1.11.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,39 +24,11 @@ sidebar:
24
24
  # friends: '[友链](/friends/)'
25
25
  # about: '[关于](/about/)'
26
26
  # Sidebar widgets
27
- widget_layout:
27
+ widgets:
28
28
  index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
29
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
- 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
- # welcome
46
- welcome:
47
- layout: markdown
48
- title: Stellar 入门指南
49
- content: | # support markdown
50
- 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
51
- <br>
52
- **第一步**
53
- 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
54
- <br>
55
- **第二步**
56
- 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
57
- <br>
58
- 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
59
-
30
+ post: [toc, ghrepo] # for pages using 'layout:post'
31
+ wiki: [ghrepo, toc, wiki_more] # for pages using 'layout:wiki'
60
32
 
61
33
 
62
34
  ######## Main ########
@@ -75,7 +47,7 @@ article:
75
47
  category_color:
76
48
  '新闻稿': '#DA0F47'
77
49
  # 文章许可协议
78
- license: '本文采用 [署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。'
50
+ license: '本文采用[署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/)许可协议,转载请注明出处。'
79
51
  # 分享
80
52
  share: # [wechat, weibo, email, link]
81
53
  # 相关文章,需要安装插件 (for layout: post)
@@ -172,12 +144,13 @@ comments:
172
144
 
173
145
  # Custom emoji
174
146
  # emoji:
175
- # - https://unpkg.com/@waline/emojis@1.0.1/weibo
176
- # - https://unpkg.com/@waline/emojis@1.0.1/alus
177
- # - https://unpkg.com/@waline/emojis@1.0.1/bilibili
178
- # - https://unpkg.com/@waline/emojis@1.0.1/qq
179
- # - https://unpkg.com/@waline/emojis@1.0.1/tieba
180
- # - https://unpkg.com/@waline/emojis@1.0.1/tw-emoji
147
+ # - https://unpkg.com/@waline/emojis@1.1.0/weibo
148
+ # - https://unpkg.com/@waline/emojis@1.1.0/alus
149
+ # - https://unpkg.com/@waline/emojis@1.1.0/bilibili
150
+ # - https://unpkg.com/@waline/emojis@1.1.0/qq
151
+ # - https://unpkg.com/@waline/emojis@1.1.0/tieba
152
+ # - https://unpkg.com/@waline/emojis@1.1.0/tw-emoji
153
+ # - https://unpkg.com/@waline/emojis@1.1.0/bmoji
181
154
 
182
155
  # Comment infomation, valid meta are nick, mail and link
183
156
  # meta:
@@ -230,9 +203,10 @@ footer:
230
203
  # '更多':
231
204
  # - '[关于本站](/)'
232
205
  # - '[GitHub](/)'
233
- license: # '[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)'
234
- source: #'[GitHub](https://github.com/xaoxuu/hexo-theme-stellar)'
235
- more: # string or array (support markdown)
206
+ content: | # 支持 Markdown 格式
207
+ 本站由 [@anonymity](/) 使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 主题创建。
208
+ 本博客所有文章除特别声明外,均采用 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。
209
+ # 主题用户越多,开发者维护和更新的积极性就越高,如果您喜欢本主题,请在适当的位置显示主题信息和仓库链接以表支持。
236
210
 
237
211
 
238
212
  ######## Tag Plugins ########
@@ -252,14 +226,17 @@ tag_plugins:
252
226
  prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
253
227
  # {% emoji %}
254
228
  emoji:
255
- default: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
229
+ default: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
256
230
  twemoji: https://fastly.jsdelivr.net/gh/twitter/twemoji/assets/svg/%s.svg
257
- qq: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
258
- aru: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/aru-l/%s.gif
259
- tieba: https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/tieba/%s.png
231
+ qq: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
232
+ aru: https://fastly.jsdelivr.net/gh/cdn-x/emoji/aru-l/%s.gif
233
+ tieba: https://fastly.jsdelivr.net/gh/cdn-x/emoji/tieba/%s.png
260
234
  # {% image %}
261
235
  image:
262
236
  fancybox: # true, false
237
+ # {% timeline %}
238
+ timeline:
239
+ max-height: 80vh
263
240
 
264
241
 
265
242
  ######## JS Plugins ########
@@ -268,9 +245,15 @@ plugins:
268
245
  # jquery
269
246
  jquery: https://fastly.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
270
247
 
271
- # issues api
272
- sitesjs: /js/plugins/sites.js
273
- friendsjs: /js/plugins/friends.js
248
+ # stellar api
249
+ stellar:
250
+ sites: /js/plugins/sites.js
251
+ friends: /js/plugins/friends.js
252
+ ghinfo: /js/plugins/ghinfo.js
253
+ timeline: /js/plugins/timeline.js
254
+
255
+
256
+ marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
274
257
 
275
258
  ## optional plugins ##
276
259
  # preload
@@ -341,9 +324,34 @@ plugins:
341
324
 
342
325
  style:
343
326
  darkmode: auto # auto / always / false
344
- theme:
345
- light: '#f8f8f8'
346
- dark: '#313438'
327
+ smooth_scroll: true # true / false
328
+ font-size: 16px
329
+ 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
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' # 行内代码颜色
347
355
  animated_avatar:
348
356
  animate: auto # auto, always
349
357
  background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
@@ -0,0 +1,46 @@
1
+ # 您可以在这里创建属于自己的侧边栏组件库,在需要的位置放置自己的组件
2
+ # layout即组件布局,支持自定义的有:
3
+ # - markdown: 渲染 md 文本
4
+ #
5
+
6
+ # ---- 内置组件,暂时不支持覆盖 ----
7
+ ghrepo:
8
+ layout: ghrepo
9
+ wiki_more:
10
+ layout: wiki_more
11
+
12
+ # ---- 默认组件,可以覆盖自定义配置 ----
13
+ # 将其覆盖设置为空,可删除一个默认组件,例如 welcome:
14
+ # Recent update
15
+ recent:
16
+ layout: recent
17
+ rss: # /atom.xml # npm i hexo-generator-feed
18
+ limit: 5 # Count of posts
19
+ # TOC (valid only in layout:post/wiki)
20
+ toc:
21
+ layout: toc
22
+ list_number: false
23
+ min_depth: 2
24
+ max_depth: 5
25
+ fallback: recent # Use a backup widget when toc does not exist.
26
+ # github user info
27
+ ghuser:
28
+ layout: ghuser
29
+ api: https://api.github.com
30
+ username: github # your github login username
31
+ avatar: true # true / false
32
+
33
+
34
+ welcome:
35
+ layout: markdown
36
+ title: Stellar 入门指南
37
+ content: | # support markdown
38
+ 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
39
+ <br>
40
+ **第一步**
41
+ 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
42
+ <br>
43
+ **第二步**
44
+ 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
45
+ <br>
46
+ 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
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
@@ -36,11 +35,6 @@ meta:
36
35
  day: days ago
37
36
  month: months ago
38
37
 
39
- footer:
40
- license: 'All articles in this blog are licensed under %s unless stating additionally.'
41
- info_not_open_source: 'This site was deployed by %s using %s.'
42
- info_open_source: 'This site was deployed by %s using %s. You can find the source code in %s.'
43
-
44
38
  page:
45
39
  error:
46
40
  what: Page Not Found
@@ -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: 分钟前
@@ -36,11 +35,6 @@ meta:
36
35
  day: 天前
37
36
  month: 个月前
38
37
 
39
- footer:
40
- license: '本博客所有文章除特别声明外,均采用 %s 许可协议,转载请注明出处。'
41
- info_not_open_source: '本站由 %s 使用 %s 主题创建。'
42
- info_open_source: '本站由 %s 使用 %s 主题创建,您可以在 %s 找到本站源码。'
43
-
44
38
  page:
45
39
  error:
46
40
  what: 很抱歉,您访问的页面不存在
@@ -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: 分鐘前
@@ -36,11 +35,6 @@ meta:
36
35
  day: 天前
37
36
  month: 個月前
38
37
 
39
- footer:
40
- license: '本網誌所有文章除特別聲明外,均採用 %s 授權條款。轉載請註明出處。'
41
- info_not_open_source: '本站由 %s 使用 %s 主題建立。'
42
- info_open_source: '本站由 %s 使用 %s 主題建立。您可以在 %s 找到本站原始碼。'
43
-
44
38
  page:
45
39
  error:
46
40
  what: 抱歉,找不到您存取的頁面
package/layout/404.ejs CHANGED
@@ -2,7 +2,7 @@
2
2
  page.menu_id = '404';
3
3
  page.layout = '404';
4
4
  page.comment_title = '';
5
- page.header = false;
5
+ page.header = 'auto';
6
6
  page.robots = 'none';
7
7
  %>
8
8
  <article class='md error-page'>
@@ -1,8 +1,5 @@
1
1
  <%
2
- const author = '[@' + config.author + '](' + config.url + config.root + ')';
3
- const using = '[' + stellar_info('name') + '](' + stellar_info('tree') + ' "v' + stellar_info('version') + '")';
4
- const source = theme.footer.source;
5
- const more = theme.footer.more;
2
+ const content = theme.footer.content;
6
3
  function layoutDiv() {
7
4
  var el = '';
8
5
  el += '<footer class="page-footer reveal fs12">';
@@ -28,19 +25,11 @@ function layoutDiv() {
28
25
  }
29
26
  // footer
30
27
  el += '<div class="text">';
31
- if (theme.footer.license) {
32
- el += markdown(__('footer.license', theme.footer.license));
33
- }
34
- if (source) {
35
- el += markdown(__('footer.info_open_source', author, using, source));
36
- } else {
37
- el += markdown(__('footer.info_not_open_source', author, using));
38
- }
39
- if (more) {
40
- if ((typeof more == 'string') && more.constructor == String) {
41
- el += markdown(more);
42
- } else if ((typeof more == 'object') && more.constructor == Array) {
43
- more.forEach((item, i) => {
28
+ if (content) {
29
+ if ((typeof content == 'string') && content.constructor == String) {
30
+ el += markdown(content);
31
+ } else if ((typeof content == 'object') && content.constructor == Array) {
32
+ content.forEach((item, i) => {
44
33
  el += markdown(item);
45
34
  });
46
35
  }
@@ -1,3 +1,3 @@
1
- <% if (page.header != false) { %>
1
+ <% if (page.header != 'auto' && page.header != false) { %>
2
2
  <%- partial('../../sidebar/header', {where: 'main'}) %>
3
3
  <% } %>
@@ -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) { %>
@@ -35,7 +35,7 @@
35
35
  el: '#valine_container',
36
36
  path: path,
37
37
  placeholder: placeholder,
38
- emojiCDN: 'https://fastly.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/',
38
+ emojiCDN: 'https://fastly.jsdelivr.net/gh/cdn-x/emoji/valine/',
39
39
  emojiMaps: getEmojiMaps(),
40
40
  }));
41
41
  });
@@ -103,11 +103,13 @@
103
103
 
104
104
  // required plugins (only load if needs)
105
105
  stellar.plugins = {
106
- jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>',
107
- sitesjs: '<%- url_for(theme.plugins.sitesjs) %>',
108
- friendsjs: '<%- url_for(theme.plugins.friendsjs) %>',
106
+ jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>'
109
107
  };
110
108
 
109
+ // stellar js
110
+ stellar.plugins.stellar = Object.assign(<%- JSON.stringify(theme.plugins.stellar) %>);
111
+
112
+ stellar.plugins.marked = Object.assign(<%- JSON.stringify(theme.plugins.marked) %>);
111
113
  // optional plugins
112
114
  if ('<%- theme.plugins.lazyload.enable %>' == 'true') {
113
115
  stellar.plugins.lazyload = Object.assign(<%- JSON.stringify(theme.plugins.lazyload) %>);
@@ -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
  }
@@ -69,6 +69,8 @@ function layoutFooterDiv() {
69
69
  }
70
70
  }
71
71
  %>
72
- <%- partial('header', {where: 'sidebar'}) %>
72
+ <% if (page.header == undefined || page.header == 'left' || page.header == 'auto') { %>
73
+ <%- partial('header', {where: 'sidebar'}) %>
74
+ <% } %>
73
75
  <%- layoutWidgets() %>
74
76
  <%- layoutFooterDiv() %>
@@ -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) {
@@ -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 += '<span>' + repo + '</span>';
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" api="https://api.github.xaoxuu.com/repos/' + repo + '/releases/latest">';
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="tag_name"></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() %>
@@ -0,0 +1,53 @@
1
+ <%
2
+ var btns = [];
3
+ btns.push({
4
+ key: 'followers',
5
+ desc: 'followers',
6
+ tab: 'followers'
7
+ });
8
+ btns.push({
9
+ key: 'following',
10
+ desc: 'following',
11
+ tab: 'following'
12
+ });
13
+ btns.push({
14
+ key: 'public_repos',
15
+ desc: 'repos',
16
+ tab: 'repositories'
17
+ });
18
+
19
+ function layoutDiv() {
20
+ var el = '';
21
+ if (item.username == undefined || item.username.length == 0) {
22
+ return el;
23
+ }
24
+
25
+ el += '<div class="widget-wrap" id="github-user">';
26
+ // body
27
+ el += '<div class="widget-body stellar-ghinfo-api" api="' + item.api + '/users/' + item.username + '">';
28
+ if (item.avatar) {
29
+ el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
30
+ }
31
+ // username
32
+ el += '<p class="username" ff="title" type="text" id="name">&nbsp;</p>';
33
+ el += '<p class="bio" type="text" id="bio">&nbsp;</p>';
34
+
35
+ el += '<div class="buttons">';
36
+ btns.forEach((btn, i) => {
37
+ el += '<a class="btn" href="https://github.com/' + item.username + '?tab=' + btn.tab + '">';
38
+ el += '<span class="title" type="text" id="' + btn.key + '">0</span>';
39
+ el += '<span class="desc">' + btn.desc + '</span>';
40
+ el += '</a>';
41
+ });
42
+ el += '</div>';
43
+ // follow
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="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
46
+ el += 'Follow';
47
+ el += '</a>';
48
+ el += '</div>';
49
+ el += '</div>';
50
+ return el;
51
+ }
52
+ %>
53
+ <%- layoutDiv() %>
@@ -92,7 +92,7 @@ function layoutDiv(fallback) {
92
92
  }
93
93
  el += '</div>';
94
94
  } else if (item.fallback) {
95
- el += partial(item.fallback, {item: theme.sidebar.widgets[item.fallback]});
95
+ el += partial(item.fallback, {item: theme.data.widgets[item.fallback]});
96
96
  }
97
97
  return el;
98
98
  }
package/layout/post.ejs CHANGED
@@ -3,7 +3,7 @@ if (page.menu_id == undefined) {
3
3
  page.menu_id = 'post';
4
4
  }
5
5
  if (page.header == undefined) {
6
- page.header = false;
6
+ page.header = 'auto';
7
7
  }
8
8
  function layoutTitle() {
9
9
  const title = page.h1 || page.title;
package/layout/wiki.ejs CHANGED
@@ -26,7 +26,7 @@ function layoutTitle() {
26
26
  <% } else { %>
27
27
  <%
28
28
  if (page.header == undefined) {
29
- page.header = false;
29
+ page.header = 'auto';
30
30
  }
31
31
  %>
32
32
  <%- partial('_partial/main/navbar/breadcrumb') %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * 部分代码借鉴自 NexT:
3
3
  * https://github.com/next-theme/hexo-theme-next/blob/master/scripts/events/lib/config.js
4
+ * Volantis:
5
+ * https://github.com/volantis-x/hexo-theme-volantis/blob/master/scripts/events/lib/cdn.js
4
6
  */
5
7
 
6
8
  'use strict';
7
9
 
10
+ const path = require('path');
11
+
8
12
  module.exports = hexo => {
9
13
 
10
14
  const { cache, language_switcher } = hexo.theme.config;
@@ -25,23 +29,35 @@ module.exports = hexo => {
25
29
 
26
30
  // merge data
27
31
  const data = hexo.locals.get('data');
32
+ // merge widgets
33
+ var widgets = hexo.render.renderSync({ path: path.join(hexo.theme_dir, '_data/widgets.yml'), engine: 'yaml' });
28
34
  if (data.widgets) {
29
- for (let id of Object.keys(data.widgets)) {
30
- hexo.theme.config.sidebar.widgets[id] = data.widgets[id];
35
+ for (let i of Object.keys(data.widgets)) {
36
+ let widget = data.widgets[i];
37
+ if (widget == null || widget.length == 0) {
38
+ // delete
39
+ delete widgets[i];
40
+ } else {
41
+ // create
42
+ if (widgets[i] == null) {
43
+ widgets[i] = widget;
44
+ } else {
45
+ // merge
46
+ for (let j of Object.keys(widget)) {
47
+ widgets[i][j] = widget[j];
48
+ }
49
+ }
50
+ }
31
51
  }
32
52
  }
53
+ if (hexo.theme.config.data == undefined) {
54
+ hexo.theme.config.data = {};
55
+ }
56
+ hexo.theme.config.data['widgets'] = widgets;
33
57
 
34
58
  // default menu
35
59
  if (hexo.theme.config.sidebar.menu == undefined) {
36
60
  hexo.theme.config.sidebar.menu = [];
37
61
  }
38
- // default widgets
39
- if (hexo.theme.config.sidebar.widgets.repo_info == undefined) {
40
- hexo.theme.config.sidebar.widgets.repo_info = {layout: 'repo_info'};
41
- }
42
- if (hexo.theme.config.sidebar.widgets.wiki_more == undefined) {
43
- hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'};
44
- }
45
-
46
62
 
47
63
  };