%
// 默认组件
if (page.sidebar == undefined) {
if (page.layout == 'post' && page.content) {
page.sidebar = theme.sidebar.widgets.post;
} else if (page.layout == 'wiki' && page.wiki) {
let proj = theme.wiki.tree[page.wiki];
if (proj?.sidebar) {
page.sidebar = proj.sidebar;
} else {
page.sidebar = theme.sidebar.widgets.wiki;
}
} else if (page.layout === 'topic') {
if (page.topic && theme.topic?.tree[page.topic]?.sidebar) {
page.sidebar = theme.topic.tree[page.topic].sidebar;
} else {
page.sidebar = theme.sidebar.widgets.topic;
}
} else if (page.layout === 'index_topic') {
page.sidebar = theme.sidebar.widgets.index_topic
} else if (is_home()) {
page.sidebar = theme.sidebar.widgets.home;
} else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
page.sidebar = theme.sidebar.widgets.blog_index;
} else if (['wiki_index'].includes(page.layout)) {
page.sidebar = theme.sidebar.widgets.wiki_index;
} else if (['404', undefined].includes(page.layout)) {
page.sidebar = theme.sidebar.widgets.others;
} else if (page.layout == 'page') {
page.sidebar = theme.sidebar.widgets.page;
} else {
page.sidebar = [];
}
}
// parse array string
if (typeof page.sidebar == 'string') {
page.sidebar = page.sidebar.replace(/ /g, '').split(',');
}
function layoutTitle(main, url, sub) {
var el = '';
el += '';
el += '