diff --git a/_config.yml b/_config.yml index 6f930dc..c946daa 100755 --- a/_config.yml +++ b/_config.yml @@ -32,7 +32,7 @@ menu: ######## Main ######## # 站点主结构树 -root: +site_tree: # 主页配置 home: sidebar: search, recent, timeline diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 79925a4..0f8d2af 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -64,7 +64,7 @@ function layoutDiv() { nodes.push('/'); // menu_id el += ''; - let url = url_for(theme.root.topic.base_dir); + let url = url_for(theme.site_tree.topic.base_dir); nodes.push(url); el += '' + __("btn.topic") + ''; // 专栏名 @@ -100,7 +100,7 @@ function layoutDiv() { nodes.push(url); el += '' + __(md_text(theme.menu[page.menu_id])) + ''; } else { - let url = url_for(theme.root.wiki.base_dir); + let url = url_for(theme.site_tree.wiki.base_dir); nodes.push(url); el += '' + __("btn.wiki") + ''; } diff --git a/layout/_partial/main/navbar/nav_tabs_blog.ejs b/layout/_partial/main/navbar/nav_tabs_blog.ejs index fcf766b..36fa605 100644 --- a/layout/_partial/main/navbar/nav_tabs_blog.ejs +++ b/layout/_partial/main/navbar/nav_tabs_blog.ejs @@ -31,9 +31,9 @@ function layoutDiv() { if (theme.topic?.publish_list?.length > 0) { if (page.layout == 'index_topic') { - el += '' + __("btn.topic") + ''; + el += '' + __("btn.topic") + ''; } else { - el += '' + __("btn.topic") + ''; + el += '' + __("btn.topic") + ''; } } @@ -45,7 +45,7 @@ function layoutDiv() { } } - const { nav_tabs } = theme.root.blog + const { nav_tabs } = theme.site_tree.blog if (nav_tabs) { for (let key of Object.keys(nav_tabs)) { // 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配 diff --git a/layout/_partial/main/navbar/nav_tabs_wiki.ejs b/layout/_partial/main/navbar/nav_tabs_wiki.ejs index e477203..2d6f81b 100644 --- a/layout/_partial/main/navbar/nav_tabs_wiki.ejs +++ b/layout/_partial/main/navbar/nav_tabs_wiki.ejs @@ -8,7 +8,7 @@ function layoutDiv() { if (page.filter === false) { el += ' class="active"'; } - el += ' href="' + url_for(theme.root.wiki.base_dir) + '">' + __("btn.all_wiki") + ''; + el += ' href="' + url_for(theme.site_tree.wiki.base_dir) + '">' + __("btn.all_wiki") + ''; el += ''; // 项目分类 const { shelf, all_tags } = theme.wiki; @@ -25,7 +25,7 @@ function layoutDiv() { } } - const { nav_tabs } = theme.root.wiki + const { nav_tabs } = theme.site_tree.wiki if (nav_tabs) { for (let key of Object.keys(nav_tabs)) { // 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配 diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index 0b06722..013cae7 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -1,23 +1,23 @@ <% if (page.sidebar == null) { - const root = theme.root + const { site_tree } = theme var sidebar if (is_home()) { - sidebar = root.home.sidebar + sidebar = site_tree.home.sidebar } else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) { - sidebar = root.blog.sidebar + sidebar = site_tree.blog.sidebar } else if (page.layout === 'index_topic' || page.layout === 'topic') { - sidebar = root.topic.sidebar + sidebar = site_tree.topic.sidebar } else if (page.layout === 'index_wiki' || page.layout === 'wiki') { - sidebar = root.wiki.sidebar + sidebar = site_tree.wiki.sidebar } else if (page.layout === '404') { - sidebar = root.error_page.sidebar + sidebar = site_tree.error_page.sidebar } else if (page.layout === 'page') { - sidebar = root.page.sidebar + sidebar = site_tree.page.sidebar } else if (page.layout === 'post') { - sidebar = root.post.sidebar + sidebar = site_tree.post.sidebar } else if (page.layout == null) { - sidebar = root.page.sidebar + sidebar = site_tree.page.sidebar } else { sidebar = [] } @@ -62,7 +62,7 @@ function layoutWidgets() { if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') { el += '
'; // all products - el += ''; + el += ''; el += ''; el += __('btn.all_wiki'); el += ''; diff --git a/scripts/events/lib/authors.js b/scripts/events/lib/authors.js index e9857ef..f5e7288 100644 --- a/scripts/events/lib/authors.js +++ b/scripts/events/lib/authors.js @@ -6,7 +6,7 @@ module.exports = ctx => { var authors = ctx.locals.get('data').authors || {} - let basePath = ctx.theme.config.root.author.base_dir + let basePath = ctx.theme.config.site_tree.author.base_dir // url for (let key of Object.keys(authors)) { let author = authors[key] diff --git a/scripts/events/lib/doc_tree.js b/scripts/events/lib/doc_tree.js index 0386d26..34416f9 100644 --- a/scripts/events/lib/doc_tree.js +++ b/scripts/events/lib/doc_tree.js @@ -177,7 +177,7 @@ module.exports = ctx => { } all_tags[tag_name] = { name: tag_name, - path: (ctx.theme.config.root.wiki.base_dir) + '/tags/' + tag_name + '/index.html', + path: (ctx.theme.config.site_tree.wiki.base_dir) + '/tags/' + tag_name + '/index.html', items: items } }) diff --git a/scripts/generators/404.js b/scripts/generators/404.js index 294042c..c388d5b 100644 --- a/scripts/generators/404.js +++ b/scripts/generators/404.js @@ -3,13 +3,13 @@ */ hexo.extend.generator.register('404', function (locals) { - const { root } = hexo.theme.config + const { site_tree } = hexo.theme.config return { - path: root.error_page['404'], + path: site_tree.error_page['404'], layout: ['404'], data: { layout: '404', - menu_id: root.error_page.menu_id + menu_id: site_tree.error_page.menu_id } } }) \ No newline at end of file diff --git a/scripts/generators/author.js b/scripts/generators/author.js index 8624dd3..b3fc7fd 100644 --- a/scripts/generators/author.js +++ b/scripts/generators/author.js @@ -3,7 +3,7 @@ */ hexo.extend.generator.register('author', function (locals) { - const { root, authors } = hexo.theme.config + const { site_tree, authors } = hexo.theme.config var pages = [] for (let key of Object.keys(authors)) { const author = authors[key] @@ -15,8 +15,8 @@ hexo.extend.generator.register('author', function (locals) { layout: ['archive'], data: { author: author, - sidebar: root.author.sidebar, - menu_id: root.author.menu_id + sidebar: site_tree.author.sidebar, + menu_id: site_tree.author.menu_id } }) } diff --git a/scripts/generators/topic.js b/scripts/generators/topic.js index 380d659..b465082 100644 --- a/scripts/generators/topic.js +++ b/scripts/generators/topic.js @@ -3,18 +3,18 @@ */ hexo.extend.generator.register('topic', function (locals) { - const { root, topic } = hexo.theme.config + const { site_tree, topic } = hexo.theme.config const topicIdList = Object.keys(topic.tree) if (topicIdList.length == 0) { return {} } var ret = [] ret.push({ - path: root.topic.base_dir + '/index.html', + path: site_tree.topic.base_dir + '/index.html', layout: ['index_topic'], data: { layout: 'index_topic', - menu_id: root.topic.menu_id + menu_id: site_tree.topic.menu_id } }) return ret diff --git a/scripts/generators/wiki.js b/scripts/generators/wiki.js index 94f2499..cdb9459 100644 --- a/scripts/generators/wiki.js +++ b/scripts/generators/wiki.js @@ -3,18 +3,18 @@ */ hexo.extend.generator.register('wiki', function (locals) { - const { root, wiki } = hexo.theme.config + const { site_tree, wiki } = hexo.theme.config const wikiIdList = Object.keys(wiki.tree) if (wikiIdList.length == 0) { return {} } var ret = [] ret.push({ - path: root.wiki.base_dir + '/index.html', + path: site_tree.wiki.base_dir + '/index.html', layout: ['index_wiki'], data: { layout: 'index_wiki', - menu_id: root.wiki.menu_id, + menu_id: site_tree.wiki.menu_id, filter: false } }) @@ -26,7 +26,7 @@ hexo.extend.generator.register('wiki', function (locals) { layout: ['index_wiki'], data: { layout: 'index_wiki', - menu_id: root.wiki.menu_id, + menu_id: site_tree.wiki.menu_id, filter: true, tagName: tag.name }