default value

This commit is contained in:
xaoxuu 2021-03-22 21:40:35 +08:00
parent fe6dbaed3f
commit e339601fab
2 changed files with 10 additions and 4 deletions

View File

@ -19,14 +19,14 @@ sidebar:
avatar: '[config.avatar](/about/)' # you can set avatar link in _config.yml or '[https://xxx.png](/about/)' 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"/>](/)' title: '[config.title](/)' # you can set html tag like: '[<img no-lazy height="32px" src="xxx"/>](/)'
menu: menu:
post: '[btn.blog](/)' post: # '[btn.blog](/)'
wiki: '[btn.wiki](/wiki/)' wiki: # '[btn.wiki](/wiki/)'
friends: # '[友链](/friends/)' friends: # '[友链](/friends/)'
about: # '[关于](/about/)' about: # '[关于](/about/)'
# Sidebar widgets # Sidebar widgets
widgets: widgets:
# default layout in home/wiki/categories/tags/archives pages # default layout in home/wiki/categories/tags/archives pages
default: [welcome, recent] default: # [welcome, recent]
# Recent update # Recent update
recent: recent:
layout: recent layout: recent

View File

@ -31,8 +31,14 @@ module.exports = hexo => {
} }
} }
// default menu
if (hexo.theme.config.sidebar.menu == undefined) {
hexo.theme.config.sidebar.menu = [];
}
// default widgets // default widgets
if (hexo.theme.config.sidebar.widgets.default == undefined) {
hexo.theme.config.sidebar.widgets.default = ['welcome', 'recent'];
}
if (hexo.theme.config.sidebar.widgets.wiki_more == undefined) { if (hexo.theme.config.sidebar.widgets.wiki_more == undefined) {
hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'}; hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'};
} }