hexo-theme-stellar 1.24.1 → 1.25.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 (57) hide show
  1. package/_config.yml +69 -45
  2. package/languages/en.yml +2 -1
  3. package/languages/zh-CN.yml +2 -1
  4. package/languages/zh-TW.yml +2 -1
  5. package/layout/404.ejs +1 -3
  6. package/layout/_partial/head.ejs +1 -1
  7. package/layout/_partial/main/article/article_footer.ejs +14 -14
  8. package/layout/_partial/main/article/read_next.ejs +10 -10
  9. package/layout/_partial/main/navbar/breadcrumb.ejs +36 -14
  10. package/layout/_partial/main/navbar/{list_post.ejs → nav_tabs_blog.ejs} +15 -7
  11. package/layout/_partial/main/navbar/{list_wiki.ejs → nav_tabs_wiki.ejs} +15 -1
  12. package/layout/_partial/main/post_list/post_card.ejs +2 -13
  13. package/layout/_partial/main/post_list/topic_card.ejs +16 -0
  14. package/layout/_partial/sidebar/header.ejs +6 -7
  15. package/layout/_partial/sidebar/index.ejs +37 -29
  16. package/layout/_partial/sidebar/menu.ejs +2 -2
  17. package/layout/_partial/widgets/related.ejs +47 -20
  18. package/layout/_partial/widgets/search.ejs +1 -1
  19. package/layout/_partial/widgets/toc.ejs +52 -44
  20. package/layout/archive.ejs +1 -1
  21. package/layout/categories.ejs +1 -1
  22. package/layout/index.ejs +6 -42
  23. package/layout/index_topic.ejs +28 -0
  24. package/layout/index_wiki.ejs +42 -0
  25. package/layout/page.ejs +2 -2
  26. package/layout/tags.ejs +1 -1
  27. package/layout/topic.ejs +28 -0
  28. package/layout/wiki.ejs +11 -22
  29. package/package.json +1 -1
  30. package/scripts/events/index.js +5 -0
  31. package/scripts/events/lib/authors.js +1 -1
  32. package/scripts/events/lib/config.js +2 -2
  33. package/scripts/events/lib/doc_tree.js +1 -1
  34. package/scripts/events/lib/merge_posts.js +47 -0
  35. package/scripts/events/lib/topic_tree.js +45 -0
  36. package/scripts/generators/404.js +8 -3
  37. package/scripts/generators/author.js +4 -2
  38. package/scripts/generators/categories.js +4 -4
  39. package/scripts/generators/tags.js +4 -4
  40. package/scripts/generators/topic.js +21 -0
  41. package/scripts/generators/wiki.js +29 -28
  42. package/scripts/helpers/parse_config.js +2 -2
  43. package/scripts/tags/lib/audio.js +9 -4
  44. package/scripts/tags/lib/navbar.js +1 -1
  45. package/scripts/tags/lib/video.js +8 -8
  46. package/source/css/_common/blur.styl +4 -1
  47. package/source/css/_common/highlight.styl +1 -0
  48. package/source/css/_layout/partial/paginator.styl +2 -2
  49. package/source/css/_layout/partial/related.styl +3 -0
  50. package/source/css/_layout/tag-plugins/banner.styl +4 -1
  51. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  52. package/source/css/_layout/widgets/search.styl +4 -1
  53. package/source/js/plugins/fcircle.js +1 -1
  54. package/source/js/plugins/friends.js +1 -1
  55. package/source/js/plugins/memos.js +1 -1
  56. package/source/js/plugins/sites.js +2 -2
  57. package/source/js/plugins/weibo.js +1 -1
@@ -0,0 +1,45 @@
1
+ /**
2
+ * topic.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 用于专栏/专题文章,一个专栏类似于 wiki 模块中的一个项目文档
4
+ * 区别是:
5
+ * 1. 按发布日期排序,无需手动排序
6
+ *
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ function getTopicTree(ctx) {
12
+ var tree = {}
13
+ const data = ctx.locals.get('data')
14
+ var list = []
15
+ for (let key of Object.keys(data)) {
16
+ if (key.startsWith('topic/') && key.length > 5) {
17
+ let newKey = key.replace('topic/', '')
18
+ let obj = data[key]
19
+ obj.id = newKey
20
+ if (obj.order_by == null) {
21
+ obj.order_by = '-date'
22
+ }
23
+ if (obj.path == null) {
24
+ obj.path = `/topic/${newKey}/`
25
+ }
26
+ obj.pages = []
27
+ list.push(obj)
28
+ }
29
+ }
30
+ for (let item of list) {
31
+ tree[item.id] = item
32
+ }
33
+ return tree
34
+ }
35
+
36
+ module.exports = ctx => {
37
+ var topic = ctx.locals.get('data').topic || {}
38
+ // 专栏结构树
39
+ topic.tree = getTopicTree(ctx)
40
+ // 索引页显示的专栏列表
41
+ if (topic.publish_list == null) {
42
+ topic.publish_list = Object.keys(topic.tree)
43
+ }
44
+ ctx.theme.config.topic = topic
45
+ }
@@ -3,8 +3,13 @@
3
3
  */
4
4
 
5
5
  hexo.extend.generator.register('404', function (locals) {
6
+ const { site_tree } = hexo.theme.config
6
7
  return {
7
- path: '/404.html',
8
- layout: ['404']
8
+ path: site_tree.error_page['404'],
9
+ layout: ['404'],
10
+ data: {
11
+ layout: '404',
12
+ menu_id: site_tree.error_page.menu_id
13
+ }
9
14
  }
10
- });
15
+ })
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  hexo.extend.generator.register('author', function (locals) {
6
- const { authors } = hexo.theme.config
6
+ const { site_tree, authors } = hexo.theme.config
7
7
  var pages = []
8
8
  for (let key of Object.keys(authors)) {
9
9
  const author = authors[key]
@@ -14,7 +14,9 @@ hexo.extend.generator.register('author', function (locals) {
14
14
  path: author.path,
15
15
  layout: ['archive'],
16
16
  data: {
17
- 'author': author
17
+ author: author,
18
+ sidebar: site_tree.author.sidebar,
19
+ menu_id: site_tree.author.menu_id
18
20
  }
19
21
  })
20
22
  }
@@ -6,10 +6,10 @@ hexo.extend.generator.register('categories', function (locals) {
6
6
  if (locals.categories && locals.categories.length > 0) {
7
7
  return {
8
8
  path: hexo.config.category_dir + '/index.html',
9
- data: locals.posts,
10
- layout: ['categories']
9
+ layout: ['categories'],
10
+ data: locals.posts
11
11
  }
12
12
  } else {
13
- return {};
13
+ return {}
14
14
  }
15
- });
15
+ })
@@ -6,10 +6,10 @@ hexo.extend.generator.register('tags', function (locals) {
6
6
  if (locals.tags && locals.tags.length > 0) {
7
7
  return {
8
8
  path: hexo.config.tag_dir + '/index.html',
9
- data: locals.posts,
10
- layout: ['tags']
9
+ layout: ['tags'],
10
+ data: locals.posts
11
11
  }
12
12
  } else {
13
- return {};
13
+ return {}
14
14
  }
15
- });
15
+ })
@@ -0,0 +1,21 @@
1
+ /**
2
+ * topic v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ */
4
+
5
+ hexo.extend.generator.register('topic', function (locals) {
6
+ const { site_tree, topic } = hexo.theme.config
7
+ const topicIdList = Object.keys(topic.tree)
8
+ if (topicIdList.length == 0) {
9
+ return {}
10
+ }
11
+ var ret = []
12
+ ret.push({
13
+ path: site_tree.topic.base_dir + '/index.html',
14
+ layout: ['index_topic'],
15
+ data: {
16
+ layout: 'index_topic',
17
+ menu_id: site_tree.topic.menu_id
18
+ }
19
+ })
20
+ return ret
21
+ })
@@ -3,34 +3,35 @@
3
3
  */
4
4
 
5
5
  hexo.extend.generator.register('wiki', function (locals) {
6
- var hasWiki = false;
7
- locals.pages.forEach((page, i) => {
8
- if (page.layout == 'wiki') {
9
- hasWiki = true;
6
+ const { site_tree, wiki } = hexo.theme.config
7
+ const wikiIdList = Object.keys(wiki.tree)
8
+ if (wikiIdList.length == 0) {
9
+ return {}
10
+ }
11
+ var ret = []
12
+ ret.push({
13
+ path: site_tree.wiki.base_dir + '/index.html',
14
+ layout: ['index_wiki'],
15
+ data: {
16
+ layout: 'index_wiki',
17
+ menu_id: site_tree.wiki.menu_id,
18
+ filter: false
10
19
  }
11
- });
12
- if (hasWiki) {
13
- var ret = [];
14
- ret.push({
15
- path: (hexo.config.wiki_dir || 'wiki') + '/index.html',
16
- data: {'filter': false},
17
- layout: ['wiki']
18
- });
19
- if (hexo.theme.config.wiki && hexo.theme.config.wiki.all_tags) {
20
- for (let id of Object.keys(hexo.theme.config.wiki.all_tags)) {
21
- let tag = hexo.theme.config.wiki.all_tags[id];
22
- ret.push({
23
- path: tag.path,
24
- data: {
25
- 'filter': true,
26
- 'tagName': tag.name
27
- },
28
- layout: ['wiki']
29
- });
30
- }
20
+ })
21
+ if (wiki.all_tags) {
22
+ for (let id of Object.keys(wiki.all_tags)) {
23
+ let tag = wiki.all_tags[id]
24
+ ret.push({
25
+ path: tag.path,
26
+ layout: ['index_wiki'],
27
+ data: {
28
+ layout: 'index_wiki',
29
+ menu_id: site_tree.wiki.menu_id,
30
+ filter: true,
31
+ tagName: tag.name
32
+ }
33
+ })
31
34
  }
32
- return ret;
33
- } else {
34
- return {};
35
35
  }
36
- });
36
+ return ret
37
+ })
@@ -1,6 +1,6 @@
1
1
  /**
2
- * md_link(theme.sidebar.menu['home']) is '/'
3
- * md_text(theme.sidebar.menu['home']) is 'Home'
2
+ * md_link(theme.menu['home']) is '/'
3
+ * md_text(theme.menu['home']) is 'Home'
4
4
  */
5
5
 
6
6
  'use strict';
@@ -9,14 +9,19 @@
9
9
  'use strict';
10
10
 
11
11
  module.exports = ctx => function(args) {
12
- args = ctx.args.map(args, ['type'], ['src'])
13
- if (args.type == null) {
14
- args.type = 'audio/mp3'
12
+ args = ctx.args.map(args, ['type', 'netease', 'autoplay'], ['src'])
13
+ if (args.netease) {
14
+ return `
15
+ <div class="tag-plugin audio">
16
+ <iframe src="//music.163.com/outchain/player?type=${args.type || '2'}&id=${args.netease}&auto=${args.autoplay == 'true' ? '1' : '0'}&height=32" frameborder="no" border="0" marginwidth="0" marginheight="0" width=288px height=52>
17
+ </iframe>
18
+ </div>
19
+ `
15
20
  }
16
21
  return `
17
22
  <div class="tag-plugin audio">
18
23
  <audio controls preload>
19
- <source src="${args.src}" type="${args.type}">Your browser does not support the audio tag.
24
+ <source src="${args.src}" type="${args.type || 'audio/mp3'}">Your browser does not support the audio tag.
20
25
  </audio>
21
26
  </div>
22
27
  `
@@ -25,7 +25,7 @@ module.exports = ctx => function(args) {
25
25
  let text = matches[1]
26
26
  let href = matches[2]
27
27
  if (href == args.active) {
28
- el += `<a class="link blur active" href="${href}">${text}</a>`
28
+ el += `<a class="link active" href="${href}">${text}</a>`
29
29
  } else {
30
30
  el += `<a class="link" href="${href}">${text}</a>`
31
31
  }
@@ -9,22 +9,22 @@
9
9
  'use strict';
10
10
 
11
11
  module.exports = ctx => function(args) {
12
- args = ctx.args.map(args, ['type', 'bilibili', 'ratio'], ['src'])
12
+ args = ctx.args.map(args, ['type', 'bilibili', 'ratio', 'width', 'autoplay'], ['src'])
13
+ if (args.width == null) {
14
+ args.width = '100%'
15
+ }
13
16
  if (args.bilibili) {
14
17
  return `
15
- <div class="tag-plugin video" style="aspect-ratio:${args.ratio || 16/9}">
16
- <iframe src="https://player.bilibili.com/player.html?bvid=${args.bilibili}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
18
+ <div class="tag-plugin video" style="aspect-ratio:${args.ratio || 16/9};max-width:${args.width};">
19
+ <iframe src="https://player.bilibili.com/player.html?bvid=${args.bilibili}&autoplay=${args.autoplay || 'false'}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
17
20
  </iframe>
18
21
  </div>
19
22
  `
20
23
  }
21
- if (args.type == null) {
22
- args.type = 'video/mp4'
23
- }
24
24
  return `
25
- <div class="tag-plugin video">
25
+ <div class="tag-plugin video" style="max-width:${args.width};">
26
26
  <video controls preload>
27
- <source src="${args.src}" type="${args.type}">Your browser does not support the video tag.
27
+ <source src="${args.src}" type="${args.type || 'video/mp4'}">Your browser does not support the video tag.
28
28
  </video>
29
29
  </div>
30
30
  `
@@ -9,7 +9,7 @@ if hexo-config('style.darkmode') == 'always'
9
9
  :root
10
10
  --blur-bg: alpha(black, .5)
11
11
 
12
- .blur
12
+ blur-effect()
13
13
  background: var(--blur-bg)
14
14
  @supports ((-webkit-backdrop-filter:blur(var(--blur-px))) or (backdrop-filter:blur(var(--blur-px))))
15
15
  background: var(--blur-bg) !important
@@ -17,3 +17,6 @@ if hexo-config('style.darkmode') == 'always'
17
17
  -webkit-backdrop-filter: saturate(200%) blur(var(--blur-px))
18
18
  &:hover
19
19
  background: var(--card)
20
+
21
+ .blur
22
+ blur-effect()
@@ -75,6 +75,7 @@ p>code:not([class]),li>code:not([class])
75
75
  padding-left: 0.25em
76
76
 
77
77
  .md-text .gist
78
+ --fgColor-default: var(--text-p1)
78
79
  .gist-file
79
80
  border: 1px solid var(--block-border)
80
81
  border-radius: $border-block
@@ -28,10 +28,10 @@
28
28
  background-clip: content-box
29
29
  &.next
30
30
  border-left: 1px dashed var(--block-border)
31
- background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/arrow/064b95430caf4.svg')
31
+ background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/arrow/064b95430caf4.svg')
32
32
  &.prev
33
33
  border-right: 1px dashed var(--block-border)
34
- background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/arrow/f049bbd4e88ec.svg')
34
+ background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/arrow/f049bbd4e88ec.svg')
35
35
  .current
36
36
  font-family: $ff-code
37
37
  background: var(--block)
@@ -45,6 +45,9 @@ article.md-text.content+.related-wrap
45
45
  -webkit-box-orient: vertical
46
46
  overflow: hidden
47
47
  -webkit-line-clamp: 2
48
+ &.active
49
+ .title
50
+ border-bottom: 1px dashed $color-theme
48
51
  &:hover
49
52
  .title
50
53
  color: $color-hover
@@ -118,4 +118,7 @@
118
118
  margin: 0 1rem
119
119
  @media screen and (max-width: $device-mobile)
120
120
  margin: 0
121
- border-radius: 0
121
+ border-radius: 0
122
+
123
+ .tag-plugin.banner .navbar a.active
124
+ blur-effect()
@@ -27,7 +27,7 @@
27
27
  margin-top: 19px
28
28
  margin-bottom: 20px
29
29
  .frame
30
- background-image: url(https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/frame/iphone11.svg);
30
+ background-image: url(https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/frame/iphone11.svg);
31
31
  width: 329px
32
32
  height: 658px
33
33
  &[focus='top']
@@ -23,7 +23,8 @@
23
23
 
24
24
  &.noresult[searching='true']
25
25
  .search-icon
26
- color: $c-red
26
+ path[p-id="1562"]
27
+ color: $c-red
27
28
  .search-form
28
29
  border: 1px solid $c-red
29
30
 
@@ -93,6 +94,8 @@
93
94
  color: var(--text-p2)
94
95
  padding: 0.5rem
95
96
  border-radius: 'calc(%s - 2px)' % $border-bar
97
+ path[p-id="1562"]
98
+ color: $color-theme
96
99
 
97
100
  #search-result,.search-no-result
98
101
  margin-top: 1rem
@@ -86,7 +86,7 @@ $(function () {
86
86
  var cfg = new Object();
87
87
  cfg.el = el;
88
88
  cfg.api = api;
89
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
89
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg';
90
90
  FCircle.layoutDiv(cfg);
91
91
  }
92
92
  });
@@ -78,7 +78,7 @@ $(function () {
78
78
  cfg.el = el;
79
79
  cfg.api = api;
80
80
  cfg.class = el.getAttribute('class');
81
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
81
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg';
82
82
  friendsjs.layout(cfg);
83
83
  }
84
84
  });
@@ -126,7 +126,7 @@ $(function () {
126
126
  cfg.host = api.replace(/https:\/\/(.*?)\/(.*)/i, '$1');
127
127
  cfg.avatar = el.getAttribute('avatar');
128
128
  if (!cfg.avatar) {
129
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
129
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg';
130
130
  }
131
131
  MemosJS.layoutDiv(cfg);
132
132
  }
@@ -80,8 +80,8 @@ $(function () {
80
80
  cfg.class = el.getAttribute('class');
81
81
  cfg.el = el;
82
82
  cfg.api = api;
83
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/link/8f277b4ee0ecd.svg';
84
- cfg.screenshot = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/cover/76b86c0226ffd.svg';
83
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/link/8f277b4ee0ecd.svg';
84
+ cfg.screenshot = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/cover/76b86c0226ffd.svg';
85
85
  sitesjs.layout(cfg);
86
86
  }
87
87
  });
@@ -110,7 +110,7 @@ $(function () {
110
110
  var cfg = new Object();
111
111
  cfg.el = el;
112
112
  cfg.api = api;
113
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
113
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg';
114
114
  weibojs.layoutDiv(cfg);
115
115
  }
116
116
  });