[opt] refactoring
This commit is contained in:
parent
bb03ea976d
commit
041084678e
31
_config.yml
31
_config.yml
|
@ -16,7 +16,21 @@ open_graph:
|
|||
enable: true
|
||||
twitter_id: # for open_graph meta
|
||||
|
||||
######## head tags ########
|
||||
|
||||
######## Sidebar ########
|
||||
logo:
|
||||
avatar: '[config.avatar](/about/)' # you can set avatar link in _config.yml or '[https://xxx.png](/about/)'
|
||||
title: '[config.title](/)' # you can set html tag like: '[<img no-lazy height="32px" src="xxx"/>](/)'
|
||||
subtitle: # 文字1 | 文字2(鼠标放上去会切换到文字2)
|
||||
|
||||
menu:
|
||||
# post: '[btn.blog](/)'
|
||||
# wiki: '[btn.wiki](/wiki/)'
|
||||
# friends: '[友链](/friends/)'
|
||||
# about: '[关于](/about/)'
|
||||
|
||||
|
||||
######## Main ########
|
||||
# 站点主结构树
|
||||
root:
|
||||
# 主页配置
|
||||
|
@ -57,22 +71,7 @@ root:
|
|||
page:
|
||||
sidebar: toc, search
|
||||
|
||||
######## Sidebar ########
|
||||
logo:
|
||||
avatar: '[config.avatar](/about/)' # you can set avatar link in _config.yml or '[https://xxx.png](/about/)'
|
||||
title: '[config.title](/)' # you can set html tag like: '[<img no-lazy height="32px" src="xxx"/>](/)'
|
||||
subtitle: # 文字1 | 文字2(鼠标放上去会切换到文字2)
|
||||
|
||||
menu:
|
||||
# post: '[btn.blog](/)'
|
||||
# wiki: '[btn.wiki](/wiki/)'
|
||||
# friends: '[友链](/friends/)'
|
||||
# about: '[关于](/about/)'
|
||||
|
||||
|
||||
######## Main ########
|
||||
breadcrumb:
|
||||
home: home # config.title / config.author / home or custom content
|
||||
|
||||
######## Article ########
|
||||
article:
|
||||
|
|
|
@ -5,15 +5,6 @@ function layoutDiv() {
|
|||
return el;
|
||||
}
|
||||
var home_title = __("btn.home");
|
||||
if (theme.breadcrumb && theme.breadcrumb.home) {
|
||||
if (theme.breadcrumb.home === 'config.title') {
|
||||
home_title = config.title;
|
||||
} else if (theme.breadcrumb.home === 'config.author') {
|
||||
home_title = config.author;
|
||||
} else if (theme.breadcrumb.home !== 'home') {
|
||||
home_title = theme.breadcrumb.home;
|
||||
}
|
||||
}
|
||||
if (page.layout === "post") {
|
||||
var firstCat = "";
|
||||
if (page.categories && page.categories.length > 0) {
|
||||
|
|
|
@ -69,18 +69,7 @@ function div_default() {
|
|||
// meta
|
||||
el += '<div class="meta cap">';
|
||||
el += '<span class="cap" id="post-meta">';
|
||||
// author
|
||||
var author = null
|
||||
if (theme.authors) {
|
||||
if (page.author?.length > 0 && theme.authors[page.author] != null) {
|
||||
author = theme.authors[page.author]
|
||||
} else {
|
||||
author = theme.default_author
|
||||
}
|
||||
}
|
||||
if (author) {
|
||||
el += author.name + ' '
|
||||
}
|
||||
|
||||
// time
|
||||
el += __("meta.created") + ' ' + '<time datetime="' + date_xml(post.date) + '">' + date(post.date, config.date_format) + '</time>';
|
||||
el += '</span>';
|
||||
|
|
|
@ -12,10 +12,12 @@ if (page.sidebar == null) {
|
|||
sidebar = root.wiki.sidebar
|
||||
} else if (page.layout === '404') {
|
||||
sidebar = root.error_page.sidebar
|
||||
} else if (page.layout === null || page.layout === 'page') {
|
||||
} else if (page.layout === 'page') {
|
||||
sidebar = root.page.sidebar
|
||||
} else if (page.layout == 'post') {
|
||||
} else if (page.layout === 'post') {
|
||||
sidebar = root.post.sidebar
|
||||
} else if (page.layout == null) {
|
||||
sidebar = root.page.sidebar
|
||||
} else {
|
||||
sidebar = []
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ function layoutArchiveList() {
|
|||
el += partial('_partial/main/navbar/author_banner')
|
||||
} else {
|
||||
page.title = __('btn.archives')
|
||||
el += partial('_partial/main/navbar/list_post')
|
||||
el += partial('_partial/main/navbar/nav_tabs_blog')
|
||||
}
|
||||
el += `<div class="post-list archives">`
|
||||
var years = []
|
||||
|
|
|
@ -15,6 +15,7 @@ hexo.extend.generator.register('author', function (locals) {
|
|||
layout: ['archive'],
|
||||
data: {
|
||||
author: author,
|
||||
sidebar: root.author.sidebar,
|
||||
menu_id: root.author.menu_id
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue