hexo-theme-volantis 5.7.5 → 5.7.7

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 (38) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/_config.yml +1 -1
  3. package/layout/_partial/_cover/dock.ejs +1 -1
  4. package/layout/_partial/_cover/featured.ejs +1 -1
  5. package/layout/_partial/_cover/focus.ejs +1 -1
  6. package/layout/_partial/_cover/search.ejs +1 -1
  7. package/layout/_partial/article.ejs +3 -3
  8. package/layout/_partial/footer.ejs +1 -1
  9. package/layout/_partial/head.ejs +6 -10
  10. package/layout/_partial/header.ejs +3 -3
  11. package/layout/_partial/meta.ejs +2 -2
  12. package/layout/_partial/post.ejs +1 -1
  13. package/layout/_partial/scripts/global.ejs +10 -4
  14. package/layout/_plugins/_page_plugins/index.ejs +3 -3
  15. package/layout/_plugins/aplayer/script.ejs +1 -1
  16. package/layout/_plugins/comments/discuss/script.ejs +1 -1
  17. package/layout/_plugins/highlight/prismjs/script.ejs +2 -2
  18. package/layout/_plugins/pjax/index.ejs +1 -1
  19. package/layout/_plugins/share/layout.ejs +1 -1
  20. package/layout/_widget/_pre.ejs +1 -1
  21. package/layout/_widget/blogger.ejs +1 -1
  22. package/layout/_widget/copyright.ejs +2 -2
  23. package/layout/_widget/grid.ejs +1 -1
  24. package/layout/_widget/list.ejs +1 -1
  25. package/layout/_widget/load.ejs +2 -2
  26. package/layout/_widget/qrcode.ejs +1 -1
  27. package/layout/_widget/references.ejs +1 -1
  28. package/layout/_widget/text.ejs +1 -1
  29. package/layout/archive.ejs +1 -1
  30. package/layout/friends.ejs +4 -4
  31. package/layout/layout.ejs +2 -2
  32. package/package.json +1 -1
  33. package/scripts/events/index.js +3 -1
  34. package/scripts/events/lib/check-configuration.js +6 -4
  35. package/scripts/events/lib/check-environment.js +8 -0
  36. package/scripts/helpers/getList.js +11 -0
  37. package/source/js/app.js +11 -2
  38. package/source/js/plugins/rightMenus.js +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.7.7](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.6...5.7.7) (2022-11-24)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **#824:** 边界条件 ([13f4e0e](https://github.com/volantis-x/hexo-theme-volantis/commit/13f4e0e6be464519a1ea3e020b5da1b1396c1254))
9
+ * yml string to list ([11ab545](https://github.com/volantis-x/hexo-theme-volantis/commit/11ab545b52967e639938be00f78cc6bdefa885d4))
10
+
11
+
12
+ ### Performance Improvements
13
+
14
+ * **debug:** description 的配置检查改为warn警告并使用默认值 [#801](https://github.com/volantis-x/hexo-theme-volantis/issues/801) ([f82f547](https://github.com/volantis-x/hexo-theme-volantis/commit/f82f54718b081439ea40e5a105ba81be15c60de0))
15
+ * **readmore:** readmore:false 优先级高于 auto_excerpt:true ([302bf4e](https://github.com/volantis-x/hexo-theme-volantis/commit/302bf4e101689c0df9e0b8cbb1778dd18a8d5567))
16
+
17
+ ## [5.7.6](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.5...v5.7.6) (2022-09-05)
18
+
19
+
20
+ ### Performance Improvements
21
+
22
+ * **debug:** env pjax rightMenus ([7b569cc](https://github.com/volantis-x/hexo-theme-volantis/commit/7b569cce425c0b630f00e378449c4d8809e471fe))
23
+ * **side:** 如果 sidebar 为空,隐藏 sidebar ([a264a8c](https://github.com/volantis-x/hexo-theme-volantis/commit/a264a8c6f7cb8fd2537af227bd0297fcb17d720c))
24
+
3
25
  ## [5.7.5](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.4...v5.7.5) (2022-08-25)
4
26
 
5
27
 
package/_config.yml CHANGED
@@ -4,7 +4,7 @@ info:
4
4
  theme_docs: https://volantis.js.org/ # This is theme's URL.
5
5
  theme_repo: https://github.com/volantis-x/hexo-theme-volantis
6
6
  # Debug 调试模式
7
- debug: false
7
+ debug: env # false: 关闭调试模式, env:环境配置检查, pjax:调试pjax,rightMenus: 调试右键
8
8
  ############################### 默认占位图 ###############################
9
9
  default:
10
10
  avatar: volantis-static/media/placeholder/avatar/round/3442075.svg # https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
@@ -14,7 +14,7 @@
14
14
  <div class='menu navigation'>
15
15
  <div class='list-h'>
16
16
  <% if (theme.cover.features) { %>
17
- <% (theme.cover.features || []).forEach(function(value){ %>
17
+ <% getList(theme.cover.features).forEach(function(value){ %>
18
18
  <a href="<%= url_for(value.url) %>"
19
19
  <% if (value.rel) { %>
20
20
  rel="<%- value.rel %>"
@@ -14,7 +14,7 @@
14
14
  <div class='menu navigation'>
15
15
  <div class='list-h'>
16
16
  <% if (theme.cover.features) { %>
17
- <% (theme.cover.features || []).forEach(function(value){ %>
17
+ <% getList(theme.cover.features).forEach(function(value){ %>
18
18
  <a href="<%= url_for(value.url) %>"
19
19
  <% if (value.rel) { %>
20
20
  rel="<%- value.rel %>"
@@ -14,7 +14,7 @@
14
14
  <div class='menu navigation'>
15
15
  <div class='list-h'>
16
16
  <% if (theme.cover.features) { %>
17
- <% (theme.cover.features || []).forEach(function(value){ %>
17
+ <% getList(theme.cover.features).forEach(function(value){ %>
18
18
  <a href="<%= url_for(value.url) %>"
19
19
  <% if (value.rel) { %>
20
20
  rel="<%- value.rel %>"
@@ -22,7 +22,7 @@
22
22
  <div class='menu navigation'>
23
23
  <div class='list-h'>
24
24
  <% if (theme.cover.features) { %>
25
- <% (theme.cover.features || []).forEach(function(value){ %>
25
+ <% getList(theme.cover.features).forEach(function(value){ %>
26
26
  <a href="<%= url_for(value.url) %>"
27
27
  <% if (value.rel) { %>
28
28
  rel="<%- value.rel %>"
@@ -33,7 +33,7 @@
33
33
  </section>
34
34
  <section class='body'>
35
35
  <ul>
36
- <% (page.references||[]).forEach(function(row){ %>
36
+ <% getList(page.references).forEach(function(row){ %>
37
37
  <li>
38
38
  <a href="<%- url_for(row.url) %>" rel="external nofollow noopener noreferrer" target="_blank">
39
39
  <%- row.title || url_for(row.url) %>
@@ -104,7 +104,7 @@
104
104
  <% } else { %>
105
105
  <div class='copyright'>
106
106
  <blockquote>
107
- <% (footer_widget.copyright.content||[]).forEach(function(row){ %>
107
+ <% getList(footer_widget.copyright.content).forEach(function(row){ %>
108
108
  <% if (row == 'permalink') { %>
109
109
  <p><%- footer_widget.copyright.permalink %><a href="<%- decodeURI(page.permalink) %>"><%- decodeURI(page.permalink) %></a></p>
110
110
  <% } else { %>
@@ -119,7 +119,7 @@
119
119
  <% if (['post'].includes(page.layout) && footer_widget.donate && footer_widget.donate.enable == true) { %>
120
120
  <div class='donate'>
121
121
  <div class='imgs'>
122
- <% (footer_widget.donate.images||[]).forEach(function(url){ %>
122
+ <% getList(footer_widget.donate.images).forEach(function(url){ %>
123
123
  <img src='<%- url_for(url) %>'>
124
124
  <% }) %>
125
125
  </div>
@@ -20,7 +20,7 @@
20
20
  <% if (item == 'social') { %>
21
21
  <br>
22
22
  <div class="social-wrapper" itemprop="about" itemscope itemtype="http://schema.org/Thing">
23
- <% (theme.site_footer.social||[]).forEach(function(value){ %>
23
+ <% getList(theme.site_footer.social).forEach(function(value){ %>
24
24
  <% if (value.url && (value.icon || value.img || value.avatar)) { %>
25
25
  <a href="<%= url_for(value.url) %>"
26
26
  class="social <%- value.icon %> flat-btn"
@@ -8,7 +8,7 @@
8
8
  <!-- 渲染优化 -->
9
9
  <%_ if (theme.dns_prefetch && theme.dns_prefetch.length){ _%>
10
10
  <meta http-equiv='x-dns-prefetch-control' content='on' />
11
- <%_ ([...theme.dns_prefetch]).forEach(function(item){ _%>
11
+ <%_ getList(theme.dns_prefetch).forEach(function(item){ _%>
12
12
  <link rel='dns-prefetch' href='<%- item %>'>
13
13
  <link rel="preconnect" href="<%- item %>" crossorigin>
14
14
  <%_ }) _%>
@@ -26,7 +26,7 @@
26
26
  <meta content="telephone=no" name="format-detection">
27
27
  <!-- import head_begin begin -->
28
28
  <%_ if (config.import && config.import.head_begin){ _%>
29
- <%_ ([...config.import.head_begin]).forEach(function(item){ _%>
29
+ <%_ getList(config.import.head_begin).forEach(function(item){ _%>
30
30
  <%- item %>
31
31
  <%_ }) _%>
32
32
  <%_ } _%>
@@ -41,13 +41,9 @@
41
41
  <%- generate_preload_fontfamily(theme) %>
42
42
  <!-- feed -->
43
43
  <%_ if (config.feed && config.feed.path){ _%>
44
- <%_ if (typeof(config.feed.path)=="string"){ _%>
45
- <%- feed_tag(config.feed.path, {title: config.title}) %>
46
- <%_ }else{ _%>
47
- <%_ ([...config.feed.path]).forEach(function(item){ _%>
48
- <%- feed_tag(item, {title: config.title}) %>
49
- <%_ }) _%>
50
- <%_ } _%>
44
+ <%_ getList(config.feed.path).forEach(function(item){ _%>
45
+ <%- feed_tag(item, {title: config.title}) %>
46
+ <%_ }) _%>
51
47
  <%_ } _%>
52
48
  <!-- 页面元数据 -->
53
49
  <%- generate_title(config, theme, page) %>
@@ -72,7 +68,7 @@
72
68
  <%- partial('scripts/global') %>
73
69
  <!-- import head_end begin -->
74
70
  <%_ if (config.import && config.import.head_end){ _%>
75
- <%_ ([...config.import.head_end]).forEach(function(item){ _%>
71
+ <%_ getList(config.import.head_end).forEach(function(item){ _%>
76
72
  <%- item %>
77
73
  <%_ }) _%>
78
74
  <%_ } _%>
@@ -77,7 +77,7 @@
77
77
  </a>
78
78
  <% if (value.rows) { %>
79
79
  <ul class="list-v">
80
- <% value.rows.forEach(function(value){ %>
80
+ <% getList(value.rows).forEach(function(value){ %>
81
81
  <% menu(value, type) %>
82
82
  <%})%>
83
83
  </ul>
@@ -85,7 +85,7 @@
85
85
  </li>
86
86
  <% } %>
87
87
  <% } %>
88
- <% menu_list.forEach(function(value){ %>
88
+ <% getList(menu_list).forEach(function(value){ %>
89
89
  <% menu(value, 'pc') %>
90
90
  <% }) %>
91
91
  </ul>
@@ -106,7 +106,7 @@
106
106
  <li>
107
107
  <a class="s-menu fa-solid fa-bars fa-fw" target="_self" href="/" onclick="return false;" title="menu"></a>
108
108
  <ul class="menu-phone list-v navigation white-box">
109
- <% menu_list.forEach(function(value){ %>
109
+ <% getList(menu_list).forEach(function(value){ %>
110
110
  <% menu(value, 'mobile') %>
111
111
  <% }) %>
112
112
  </ul>
@@ -35,7 +35,7 @@ if (post.bottom_meta == false) {
35
35
  <%- post.title %>
36
36
  </h1>
37
37
  <div class='new-meta-box'>
38
- <% (topMetas).forEach(function(meta) { %>
38
+ <% getList(topMetas).forEach(function(meta) { %>
39
39
  <% if (meta in theme.article.body.meta_library){ %>
40
40
  <%- partial('../_meta/' + meta, {post: post}) %>
41
41
  <% } %>
@@ -53,7 +53,7 @@ if (post.bottom_meta == false) {
53
53
  <% } else if (position == 'bottom') { %>
54
54
  <div class='article-meta' id="bottom">
55
55
  <div class='new-meta-box'>
56
- <% (bottomMetas).forEach(function(meta){ %>
56
+ <% getList(bottomMetas).forEach(function(meta){ %>
57
57
  <% if (meta in theme.article.body.meta_library) { %>
58
58
  <%- partial('../_meta/' + meta, {post: post}) %>
59
59
  <% } %>
@@ -21,7 +21,7 @@
21
21
  showCat = true;
22
22
  }
23
23
  let showReadmore = false;
24
- if (theme.article.preview.readmore == 'always' || theme.article.preview.auto_excerpt || ((post.readmore != false) && (post.excerpt || post.description || post.link))) {
24
+ if (theme.article.preview.readmore == 'always' || ((post.readmore != false) && (theme.article.preview.auto_excerpt || post.excerpt || post.description || post.link))) {
25
25
  showReadmore = true;
26
26
  }
27
27
  %>
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  /************这个文件存放不需要重载的全局变量和全局函数*********/
3
3
  window.volantis = {}; // volantis 全局变量
4
- volantis.debug = <%- theme.debug %>; // 开启调试模式
4
+ volantis.debug = "<%- theme.debug %>"; // 调试模式
5
5
  volantis.dom = {}; // 页面Dom see: /source/js/app.js etc.
6
6
 
7
7
  volantis.GLOBAL_CONFIG ={
@@ -363,8 +363,11 @@
363
363
  volantis.requestAnimationFrame(loop)
364
364
  }
365
365
  volantis.scroll.handleScrollEvents()
366
+ volantis.scroll.ele = null;
366
367
  // 触发页面滚动至目标元素位置
367
- volantis.scroll.to = (ele, option = {}) =>{
368
+ volantis.scroll.to = (ele, option = {}) => {
369
+ if (!ele) return;
370
+ volantis.scroll.ele = ele;
368
371
  // 默认配置
369
372
  opt = {
370
373
  top: ele.getBoundingClientRect().top + document.documentElement.scrollTop,
@@ -390,8 +393,11 @@
390
393
  // 用于处理 lazyload 引起的 cls 导致的定位失败问题
391
394
  // option.observer = false
392
395
  if (option.observer) {
393
- setTimeout(()=>{
394
- volantis.scroll.unengine.push(()=>{
396
+ setTimeout(() => {
397
+ if (volantis.scroll.ele != ele) {
398
+ return
399
+ }
400
+ volantis.scroll.unengine.push(() => {
395
401
  let me = ele.getBoundingClientRect().top
396
402
  if(!(me >= -option.observerDic && me <= option.observerDic)){
397
403
  volantis.scroll.to(ele, option)
@@ -1,5 +1,5 @@
1
1
  <%_
2
- (page.plugins||[]).forEach(function(item){
2
+ getList(page.plugins).forEach(function(item){
3
3
  try {
4
4
  if (typeof item == "string") { _%>
5
5
  <%- partial( item + "/index") %>
@@ -13,12 +13,12 @@
13
13
  没有找到页面插件:${item}
14
14
  请检查是否存在该插件,或者检查插件名称是否正确:${item}
15
15
  出问题的页面:${page.path}
16
- see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
16
+ see: https://volantis.js.org/v6/page-settings/#页面插件-page-plugins
17
17
  ================================================================================
18
18
  There is no page plugin: ${item}
19
19
  Please check if the plugin exists, or check the plugin name is correct: ${item}
20
20
  The page that has problem: ${page.path}
21
- see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
21
+ see: https://volantis.js.org/v6/page-settings/#页面插件-page-plugins
22
22
  =================================================================================`);
23
23
  }
24
24
 
@@ -26,7 +26,7 @@
26
26
  const aplayerItem = item.aplayer; if(!aplayerItem) return;
27
27
  const rightAplayerCheck = '<%= theme.rightmenu.layout.includes("music") %>' === 'true'
28
28
  && item.meta.id === '<%= theme.plugins.aplayer.id %>';
29
- if(rightAplayerCheck) RightMenuAplayer.checkAPlayer();
29
+ if(rightAplayerCheck && typeof RightMenuAplayer !="undefined") RightMenuAplayer.checkAPlayer();
30
30
  if(aplayerItem.events.events.play.every(item => {return item.name !== 'messagePlay'})) {
31
31
  aplayerItem.on('play', function messagePlay() {
32
32
  let index = aplayerItem.list.index;
@@ -1,5 +1,5 @@
1
1
  <script>
2
- volantis.layoutHelper("comments",`<div id="discuss_container"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`)
2
+ volantis.layoutHelper("comments",`<div id="discuss_container"></div>`)
3
3
  function load_discuss() {
4
4
  if(!document.querySelectorAll("#discuss_container")[0])return;
5
5
  volantis.js("<%- theme.comments.discuss.js %>", pjax_discuss)
@@ -1,7 +1,7 @@
1
- <% (theme.plugins.prismjs.js||[]).forEach(function(item) { %>
1
+ <% getList(theme.plugins.prismjs.js).forEach(function(item) { %>
2
2
  <%- js(item) %>
3
3
  <% }) %>
4
- <% (theme.plugins.prismjs.css||[]).forEach(function(item) { %>
4
+ <% getList(theme.plugins.prismjs.css).forEach(function(item) { %>
5
5
  <%- css(item) %>
6
6
  <% }) %>
7
7
  <script>
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  cacheBust: <%= theme.plugins.pjax.cacheBust %>, // url 地址追加时间戳,用以避免浏览器缓存
33
33
  timeout: <%= theme.plugins.pjax.timeout %>,
34
- <% if (theme.debug){ %> debug: true,<% } %>
34
+ <% if (theme.debug === "pjax"){ %> debug: true,<% } %>
35
35
  });
36
36
  });
37
37
 
@@ -1,6 +1,6 @@
1
1
  <div class="new-meta-item share -mob-share-list">
2
2
  <div class="-mob-share-list share-body">
3
- <% (theme.article.body.meta_library.share||[]).forEach(function(item){ %>
3
+ <% getList(theme.article.body.meta_library.share).forEach(function(item){ %>
4
4
  <% if (item.id == 'qrcode'){ %>
5
5
  <% var src = qrcode(url,{margin:1,size:8}); %>
6
6
  <div class='hoverbox'>
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  var pf = [];
3
3
  if (item.display) {
4
- item.display.forEach(function(p){
4
+ getList(item.display).forEach(function(p){
5
5
  pf.push(p);
6
6
  });
7
7
  } else {
@@ -28,7 +28,7 @@
28
28
  <% } %>
29
29
  <% if (item.social && item.social.length > 0) { %>
30
30
  <div class="social-wrapper">
31
- <% (item.social||[]).forEach(function(value){ %>
31
+ <% getList(item.social).forEach(function(value){ %>
32
32
  <% if (value.url && (value.icon || value.img || value.avatar)) { %>
33
33
  <a href="<%= url_for(value.url) %>"
34
34
  class="social <%- value.icon %> flat-btn"
@@ -3,7 +3,7 @@
3
3
  <div class='content'>
4
4
  <% if (item.blockquote == true) { %>
5
5
  <blockquote>
6
- <% (item.content||[]).forEach(function(row){ %>
6
+ <% getList(item.content).forEach(function(row){ %>
7
7
  <% if (row == 'permalink') { %>
8
8
  <p><%- item.permalink %><a href=<%- page.permalink %>><%- page.permalink %></a></p>
9
9
  <% } else { %>
@@ -12,7 +12,7 @@
12
12
  <% }) %>
13
13
  </blockquote>
14
14
  <% } else { %>
15
- <% (item.content||[]).forEach(function(row){ %>
15
+ <% getList(item.content).forEach(function(row){ %>
16
16
  <% if (row == 'permalink') { %>
17
17
  <p><%- item.permalink %><a href=<%- page.permalink %>><%- page.permalink %></a></p>
18
18
  <% } else { %>
@@ -3,7 +3,7 @@
3
3
  <%- partial('header', {item: item}) %>
4
4
  <div class='content'>
5
5
  <div class="grid navigation<%- item.fixed ? ' fixed' : '' %>">
6
- <% (item.rows||[]).forEach(function(row){ %>
6
+ <% getList(item.rows).forEach(function(row){ %>
7
7
  <a class="flat-box" href="<%- url_for(row.url) %>"
8
8
  <% if (row.rel) { %>
9
9
  rel="<%- row.rel %>"
@@ -3,7 +3,7 @@
3
3
  <%- partial('header', {item: item}) %>
4
4
  <div class='content'>
5
5
  <ul class="list entry navigation">
6
- <% (item.rows||[]).forEach(function(row){ %>
6
+ <% getList(item.rows).forEach(function(row){ %>
7
7
  <li><a class="flat-box" title="<%- url_for(row.url) %>" href="<%- url_for(row.url) %>"
8
8
  <% if (row.rel) { %>
9
9
  rel="<%- row.rel %>"
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  let widget_library_temp = [];
3
3
  %>
4
- <% (widgets||[]).forEach(function(widget){ %>
4
+ <% getList(widgets).forEach(function(widget){ %>
5
5
  <% if (theme.sidebar.widget_library && (widget in theme.sidebar.widget_library)){ %>
6
6
  <% let w = theme.sidebar.widget_library[widget]; w.id = widget; %>
7
7
  <% if(w.sticky) { %>
@@ -22,7 +22,7 @@
22
22
 
23
23
  <%
24
24
  let widget_pjax_length = 0;
25
- page.sidebar.forEach(function(e){
25
+ getList(page.sidebar).forEach(function(e){
26
26
  if (e&&theme.sidebar.widget_library&&theme.sidebar.widget_library[e]) {
27
27
  let widget_pjax_flag = theme.sidebar.widget_library[e].pjaxReload
28
28
  let widget_stickys = theme.sidebar.widget_library[e].sticky
@@ -2,7 +2,7 @@
2
2
  <section class="widget <%- item.class %> <%- page.widget_platform %> <%- page.widget_pjax %>">
3
3
  <%- partial('header', {item: item}) %>
4
4
  <div class='content article-entry'>
5
- <% (item.images||[]).forEach(function(url){ %>
5
+ <% getList(item.images).forEach(function(url){ %>
6
6
  <img src='<%- url_for(url) %>'
7
7
  <% if (item.height) { %>
8
8
  height='<%- item.height %>'
@@ -4,7 +4,7 @@ if (item.rows == undefined) {
4
4
  var itms = new Array();
5
5
  let id = item.id || 'references';
6
6
  if (id in page) {
7
- (page[id]||[]).forEach(function(ref) {
7
+ getList(page[id]).forEach(function(ref) {
8
8
  if (ref.name || ref.url) {
9
9
  item.rows.push(ref);
10
10
  }
@@ -2,7 +2,7 @@
2
2
  <section class="widget <%- item.class %> <%- page.widget_platform %> <%- page.widget_pjax %>">
3
3
  <%- partial('header', {item: item}) %>
4
4
  <div class='content'>
5
- <% (item.content||[]).forEach(function(row){ %>
5
+ <% getList(item.content).forEach(function(row){ %>
6
6
  <%- markdown(row) %>
7
7
  <% }) %>
8
8
  </div>
@@ -26,7 +26,7 @@
26
26
  <% if (post.icon) { %>
27
27
  &nbsp;<i class="<%- post.icon %>" aria-hidden="true"></i>
28
28
  <% } %>
29
- <% (post.icons && post.icons||[]).forEach(function(icon){ %>
29
+ <% getList(post.icons).forEach(function(icon){ %>
30
30
  &nbsp;<i class="<%- icon %>" aria-hidden="true"></i>
31
31
  <% }) %>
32
32
  </a>
@@ -4,7 +4,7 @@
4
4
  <%- partial('_partial/meta',{post: page, position: 'top'}) %>
5
5
  <%- page.excerpt %>
6
6
  <% if (site.data.friends){ %>
7
- <% site.data.friends.forEach((group, i) => { %>
7
+ <% getList(site.data.friends).forEach((group, i) => { %>
8
8
  <div class='friends-group'>
9
9
  <br>
10
10
  <h2 class='friend-header'>
@@ -15,7 +15,7 @@
15
15
  <%} %>
16
16
  <% if (theme.pages.friends.layout_scheme == 'traditional') { %>
17
17
  <div class='friend-content'>
18
- <% (group.items||[]).forEach(function(item){ %>
18
+ <% getList(group.items).forEach(function(item){ %>
19
19
  <% if (item.url && item.title) { %>
20
20
  <a class='friend-card'
21
21
  target="_blank" rel="external noopener noreferrer" href="<%- url_for(item.url || '/') %>">
@@ -28,7 +28,7 @@
28
28
  <p class="friend-name"><%- item.title %></p>
29
29
  <% if (item.keywords) { %>
30
30
  <div class='friend-tags-wrapper'>
31
- <% (item.keywords||[]).forEach(function(keyword){ %>
31
+ <% getList(item.keywords).forEach(function(keyword){ %>
32
32
  <p class="tags"><i class="fa-solid fa-hashtag fa-fw" aria-hidden="true"></i><%= keyword %></p>
33
33
  <% }) %>
34
34
  </div>
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  <% } else { %>
47
47
  <div class='simpleuser-group'>
48
- <% (group.items||[]).forEach(function(item){ %>
48
+ <% getList(group.items).forEach(function(item){ %>
49
49
  <% if (item.url && item.title) { %>
50
50
  <a class="simpleuser" target="_blank" rel="external noopener noreferrer" href="<%- url_for(item.url || '/') %>">
51
51
  <img src="<%- item.avatar || (theme.plugins.lazyload && theme.plugins.lazyload.loadingImg) %>"/>
package/layout/layout.ejs CHANGED
@@ -5,7 +5,7 @@
5
5
  <body itemscope itemtype="http://schema.org/WebPage">
6
6
  <!-- import body_begin begin-->
7
7
  <%_ if (config.import && config.import.body_begin){ _%>
8
- <%_ ([...config.import.body_begin]).forEach(function(item){ _%>
8
+ <%_ getList(config.import.body_begin).forEach(function(item){ _%>
9
9
  <%- item %>
10
10
  <%_ }) _%>
11
11
  <%_ } _%>
@@ -33,7 +33,7 @@
33
33
  </div>
34
34
  <!-- import body_end begin-->
35
35
  <%_ if (config.import && config.import.body_end){ _%>
36
- <%_ ([...config.import.body_end]).forEach(function(item){ _%>
36
+ <%_ getList(config.import.body_end).forEach(function(item){ _%>
37
37
  <%- item %>
38
38
  <%_ }) _%>
39
39
  <%_ } _%>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.7.5",
3
+ "version": "5.7.7",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -7,7 +7,9 @@ hexo.on('generateBefore', () => {
7
7
  require('./lib/config')(hexo);
8
8
  require('./lib/stellar-tag-utils')(hexo);
9
9
  require('./lib/render-stylus')(hexo);
10
- require('./lib/check-environment')(hexo);
10
+ if (hexo.theme.config.debug === "env") {
11
+ require('./lib/check-environment')(hexo);
12
+ }
11
13
  });
12
14
 
13
15
  hexo.on('ready', () => {
@@ -3,17 +3,19 @@ module.exports =(hexo) => {
3
3
  let config = hexo.config;
4
4
  let themeConfig = hexo.theme.config;
5
5
  if (!config.title) {
6
- return `title 未配置!
6
+ config.title = `Volantis`
7
+ hexo.log.warn(`title 未配置!
7
8
  请在站点配置 _config.yml 中配置 title
8
9
  see: https://hexo.io/zh-cn/docs/configuration
9
- title is not configured!`
10
+ title is not configured!`)
10
11
  }
11
12
  if (!config.description) {
12
- return `description 未配置!
13
+ config.description = `Volantis 是一个功能丰富、高度模块化的 Hexo 博客主题。得益于其强大的模块化特性,您可以轻松搭建一个极简风格的博客,也可以仿照官网搭建一个多人协作的、包含文档模块的大体量综合型博客。`
14
+ hexo.log.warn(`description 未配置!
13
15
  请在站点配置 _config.yml 中配置 description
14
16
  description主要用于SEO,告诉搜索引擎一个关于您站点的简单描述,通常建议在其中包含您网站的关键词。
15
17
  see: https://hexo.io/zh-cn/docs/configuration
16
- description is not configured!`
18
+ description is not configured!`);
17
19
  }
18
20
  if (themeConfig?.search?.service===`google`||themeConfig?.search?.service===`algolia`||themeConfig?.search?.service===`azure`||themeConfig?.search?.service===`baidu`) {
19
21
  return `原 google, algolia, azure, baidu 站内搜索 系祖传代码, 且文档丢失, 不便后续维护 在 5.0 版本被移除
@@ -57,6 +57,10 @@ Hexo: 5.4 ~ 6.x
57
57
  hexo-cli: 4.3 ~ latest
58
58
  node.js: 16.x LTS ~ latest LTS
59
59
  npm: 8.x ~ latest LTS
60
+ ============================================================
61
+ # 当前 Debug 调试模式
62
+ debug: env
63
+ 关闭调试模式主题配置文件设置 debug: false
60
64
  ============================================================`);
61
65
  throw new Error('环境配置检查失败!| Environment configuration check failed!');
62
66
  }
@@ -67,6 +71,10 @@ function CheckConfError(hexo,msg) {
67
71
  配置文件检查失败!| Configuration check failed!
68
72
  ============================================================
69
73
  ${msg}
74
+ ============================================================
75
+ # 当前 Debug 调试模式
76
+ debug: env
77
+ 关闭调试模式主题配置文件设置 debug: false
70
78
  ============================================================`);
71
79
  throw new Error('配置文件检查失败!| Configuration check failed!');
72
80
  }
@@ -0,0 +1,11 @@
1
+ // yml string to list
2
+ // yml 太烂了
3
+
4
+ hexo.extend.helper.register('getList', function (list) {
5
+ if (!list) return []
6
+ if (typeof list == "string") {
7
+ return [list]
8
+ } else {
9
+ return [...list]
10
+ }
11
+ });
package/source/js/app.js CHANGED
@@ -29,10 +29,10 @@ const locationHash = () => {
29
29
  if (target) {
30
30
  setTimeout(() => {
31
31
  if (window.location.hash.startsWith('#fn')) { // hexo-reference https://github.com/volantis-x/hexo-theme-volantis/issues/647
32
- volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant', observer:true })
32
+ volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant', observer: true })
33
33
  } else {
34
34
  // 锚点中上半部有大片空白 高度大概是 volantis.dom.header.offsetHeight
35
- volantis.scroll.to(target, { addTop: 5, behavior: 'instant', observer:true })
35
+ volantis.scroll.to(target, { addTop: 5, behavior: 'instant', observer: true })
36
36
  }
37
37
  }, 1000)
38
38
  }
@@ -71,6 +71,15 @@ const VolantisApp = (() => {
71
71
  fn.scrolltoElement(volantis.dom.bodyAnchor);
72
72
  });
73
73
 
74
+ // 如果 sidebar 为空,隐藏 sidebar。
75
+ const sidebar = document.querySelector("#l_side")
76
+ if (sidebar) {
77
+ const sectionList = sidebar.querySelectorAll("section")
78
+ if (!sectionList.length) {
79
+ document.querySelector("#l_main").classList.add("no_sidebar")
80
+ }
81
+ }
82
+
74
83
  // 站点信息 最后活动日期
75
84
  if (volantis.GLOBAL_CONFIG.sidebar.for_page.includes('webinfo') || volantis.GLOBAL_CONFIG.sidebar.for_post.includes('webinfo')) {
76
85
  const lastupd = volantis.GLOBAL_CONFIG.sidebar.webinfo.lastupd;
@@ -381,7 +381,7 @@ RightMenus.fun = (() => {
381
381
  fn[eventName]()
382
382
  }
383
383
  } catch (error) {
384
- if (volantis.GLOBAL_CONFIG.debug) {
384
+ if (volantis.GLOBAL_CONFIG.debug === "rightMenus") {
385
385
  console.error({
386
386
  id: id,
387
387
  error: error,