[opt] rename

This commit is contained in:
xaoxuu 2024-01-14 17:21:19 +08:00
parent 041084678e
commit d87309c757
11 changed files with 33 additions and 33 deletions

View File

@ -32,7 +32,7 @@ menu:
######## Main ########
# 站点主结构树
root:
site_tree:
# 主页配置
home:
sidebar: search, recent, timeline

View File

@ -64,7 +64,7 @@ function layoutDiv() {
nodes.push('/');
// menu_id
el += '<span class="sep"></span>';
let url = url_for(theme.root.topic.base_dir);
let url = url_for(theme.site_tree.topic.base_dir);
nodes.push(url);
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.topic") + '</a>';
// 专栏名
@ -100,7 +100,7 @@ function layoutDiv() {
nodes.push(url);
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __(md_text(theme.menu[page.menu_id])) + '</a>';
} else {
let url = url_for(theme.root.wiki.base_dir);
let url = url_for(theme.site_tree.wiki.base_dir);
nodes.push(url);
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
}

View File

@ -31,9 +31,9 @@ function layoutDiv() {
if (theme.topic?.publish_list?.length > 0) {
if (page.layout == 'index_topic') {
el += '<a class="active" href="' + url_for(theme.root.topic.base_dir) + '">' + __("btn.topic") + '</a>';
el += '<a class="active" href="' + url_for(theme.site_tree.topic.base_dir) + '">' + __("btn.topic") + '</a>';
} else {
el += '<a href="' + url_for(theme.root.topic.base_dir) + '">' + __("btn.topic") + '</a>';
el += '<a href="' + url_for(theme.site_tree.topic.base_dir) + '">' + __("btn.topic") + '</a>';
}
}
@ -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 的某个子页面时也应该匹配

View File

@ -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") + '</a>';
el += ' href="' + url_for(theme.site_tree.wiki.base_dir) + '">' + __("btn.all_wiki") + '</a>';
el += '</a>';
// 项目分类
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 的某个子页面时也应该匹配

View File

@ -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 += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
// all products
el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(theme.root.wiki.base_dir) + '">';
el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(theme.site_tree.wiki.base_dir) + '">';
el += '<svg aria-hidden="true" viewBox="0 0 16 16" width="1.2em" height="1.2em" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
el += __('btn.all_wiki');
el += '</a>';

View File

@ -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]

View File

@ -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
}
})

View File

@ -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
}
}
})

View File

@ -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
}
})
}

View File

@ -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

View File

@ -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
}