[opt] rename
This commit is contained in:
parent
041084678e
commit
d87309c757
|
@ -32,7 +32,7 @@ menu:
|
||||||
|
|
||||||
######## Main ########
|
######## Main ########
|
||||||
# 站点主结构树
|
# 站点主结构树
|
||||||
root:
|
site_tree:
|
||||||
# 主页配置
|
# 主页配置
|
||||||
home:
|
home:
|
||||||
sidebar: search, recent, timeline
|
sidebar: search, recent, timeline
|
||||||
|
|
|
@ -64,7 +64,7 @@ function layoutDiv() {
|
||||||
nodes.push('/');
|
nodes.push('/');
|
||||||
// menu_id
|
// menu_id
|
||||||
el += '<span class="sep"></span>';
|
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);
|
nodes.push(url);
|
||||||
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.topic") + '</a>';
|
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.topic") + '</a>';
|
||||||
// 专栏名
|
// 专栏名
|
||||||
|
@ -100,7 +100,7 @@ function layoutDiv() {
|
||||||
nodes.push(url);
|
nodes.push(url);
|
||||||
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __(md_text(theme.menu[page.menu_id])) + '</a>';
|
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __(md_text(theme.menu[page.menu_id])) + '</a>';
|
||||||
} else {
|
} else {
|
||||||
let url = url_for(theme.root.wiki.base_dir);
|
let url = url_for(theme.site_tree.wiki.base_dir);
|
||||||
nodes.push(url);
|
nodes.push(url);
|
||||||
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ function layoutDiv() {
|
||||||
|
|
||||||
if (theme.topic?.publish_list?.length > 0) {
|
if (theme.topic?.publish_list?.length > 0) {
|
||||||
if (page.layout == 'index_topic') {
|
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 {
|
} 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) {
|
if (nav_tabs) {
|
||||||
for (let key of Object.keys(nav_tabs)) {
|
for (let key of Object.keys(nav_tabs)) {
|
||||||
// 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配
|
// 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配
|
||||||
|
|
|
@ -8,7 +8,7 @@ function layoutDiv() {
|
||||||
if (page.filter === false) {
|
if (page.filter === false) {
|
||||||
el += ' class="active"';
|
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>';
|
el += '</a>';
|
||||||
// 项目分类
|
// 项目分类
|
||||||
const { shelf, all_tags } = theme.wiki;
|
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) {
|
if (nav_tabs) {
|
||||||
for (let key of Object.keys(nav_tabs)) {
|
for (let key of Object.keys(nav_tabs)) {
|
||||||
// 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配
|
// 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
<%
|
<%
|
||||||
if (page.sidebar == null) {
|
if (page.sidebar == null) {
|
||||||
const root = theme.root
|
const { site_tree } = theme
|
||||||
var sidebar
|
var sidebar
|
||||||
if (is_home()) {
|
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)) {
|
} 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') {
|
} 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') {
|
} else if (page.layout === 'index_wiki' || page.layout === 'wiki') {
|
||||||
sidebar = root.wiki.sidebar
|
sidebar = site_tree.wiki.sidebar
|
||||||
} else if (page.layout === '404') {
|
} else if (page.layout === '404') {
|
||||||
sidebar = root.error_page.sidebar
|
sidebar = site_tree.error_page.sidebar
|
||||||
} else if (page.layout === 'page') {
|
} else if (page.layout === 'page') {
|
||||||
sidebar = root.page.sidebar
|
sidebar = site_tree.page.sidebar
|
||||||
} else if (page.layout === 'post') {
|
} else if (page.layout === 'post') {
|
||||||
sidebar = root.post.sidebar
|
sidebar = site_tree.post.sidebar
|
||||||
} else if (page.layout == null) {
|
} else if (page.layout == null) {
|
||||||
sidebar = root.page.sidebar
|
sidebar = site_tree.page.sidebar
|
||||||
} else {
|
} else {
|
||||||
sidebar = []
|
sidebar = []
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ function layoutWidgets() {
|
||||||
if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') {
|
if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') {
|
||||||
el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
|
el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
|
||||||
// all products
|
// 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 += '<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 += __('btn.all_wiki');
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
module.exports = ctx => {
|
module.exports = ctx => {
|
||||||
var authors = ctx.locals.get('data').authors || {}
|
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
|
// url
|
||||||
for (let key of Object.keys(authors)) {
|
for (let key of Object.keys(authors)) {
|
||||||
let author = authors[key]
|
let author = authors[key]
|
||||||
|
|
|
@ -177,7 +177,7 @@ module.exports = ctx => {
|
||||||
}
|
}
|
||||||
all_tags[tag_name] = {
|
all_tags[tag_name] = {
|
||||||
name: 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
|
items: items
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hexo.extend.generator.register('404', function (locals) {
|
hexo.extend.generator.register('404', function (locals) {
|
||||||
const { root } = hexo.theme.config
|
const { site_tree } = hexo.theme.config
|
||||||
return {
|
return {
|
||||||
path: root.error_page['404'],
|
path: site_tree.error_page['404'],
|
||||||
layout: ['404'],
|
layout: ['404'],
|
||||||
data: {
|
data: {
|
||||||
layout: '404',
|
layout: '404',
|
||||||
menu_id: root.error_page.menu_id
|
menu_id: site_tree.error_page.menu_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hexo.extend.generator.register('author', function (locals) {
|
hexo.extend.generator.register('author', function (locals) {
|
||||||
const { root, authors } = hexo.theme.config
|
const { site_tree, authors } = hexo.theme.config
|
||||||
var pages = []
|
var pages = []
|
||||||
for (let key of Object.keys(authors)) {
|
for (let key of Object.keys(authors)) {
|
||||||
const author = authors[key]
|
const author = authors[key]
|
||||||
|
@ -15,8 +15,8 @@ hexo.extend.generator.register('author', function (locals) {
|
||||||
layout: ['archive'],
|
layout: ['archive'],
|
||||||
data: {
|
data: {
|
||||||
author: author,
|
author: author,
|
||||||
sidebar: root.author.sidebar,
|
sidebar: site_tree.author.sidebar,
|
||||||
menu_id: root.author.menu_id
|
menu_id: site_tree.author.menu_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hexo.extend.generator.register('topic', function (locals) {
|
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)
|
const topicIdList = Object.keys(topic.tree)
|
||||||
if (topicIdList.length == 0) {
|
if (topicIdList.length == 0) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
var ret = []
|
var ret = []
|
||||||
ret.push({
|
ret.push({
|
||||||
path: root.topic.base_dir + '/index.html',
|
path: site_tree.topic.base_dir + '/index.html',
|
||||||
layout: ['index_topic'],
|
layout: ['index_topic'],
|
||||||
data: {
|
data: {
|
||||||
layout: 'index_topic',
|
layout: 'index_topic',
|
||||||
menu_id: root.topic.menu_id
|
menu_id: site_tree.topic.menu_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hexo.extend.generator.register('wiki', function (locals) {
|
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)
|
const wikiIdList = Object.keys(wiki.tree)
|
||||||
if (wikiIdList.length == 0) {
|
if (wikiIdList.length == 0) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
var ret = []
|
var ret = []
|
||||||
ret.push({
|
ret.push({
|
||||||
path: root.wiki.base_dir + '/index.html',
|
path: site_tree.wiki.base_dir + '/index.html',
|
||||||
layout: ['index_wiki'],
|
layout: ['index_wiki'],
|
||||||
data: {
|
data: {
|
||||||
layout: 'index_wiki',
|
layout: 'index_wiki',
|
||||||
menu_id: root.wiki.menu_id,
|
menu_id: site_tree.wiki.menu_id,
|
||||||
filter: false
|
filter: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -26,7 +26,7 @@ hexo.extend.generator.register('wiki', function (locals) {
|
||||||
layout: ['index_wiki'],
|
layout: ['index_wiki'],
|
||||||
data: {
|
data: {
|
||||||
layout: 'index_wiki',
|
layout: 'index_wiki',
|
||||||
menu_id: root.wiki.menu_id,
|
menu_id: site_tree.wiki.menu_id,
|
||||||
filter: true,
|
filter: true,
|
||||||
tagName: tag.name
|
tagName: tag.name
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue