<% const wiki = theme.wiki.tree[page.wiki] const topic = theme.topic.tree[page.topic] if (page.leftbar == null) { const { site_tree } = theme var sidebar if (is_home()) { sidebar = site_tree.home.leftbar } else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) { sidebar = site_tree.index_blog.leftbar } else if (page.layout === 'index_topic') { // 专栏列表页等同于博客列表页 sidebar = site_tree.index_blog.leftbar } else if (page.topic?.length > 0) { // 专栏文章内页等同于普通文章内页 sidebar = site_tree.post.leftbar } else if (page.layout === 'index_wiki') { sidebar = site_tree.index_wiki.leftbar } else if (page.wiki?.length > 0) { sidebar = site_tree.wiki.leftbar } else if (page.layout === '404') { sidebar = site_tree.error_page.leftbar } else if (page.layout === 'page') { sidebar = site_tree.page.leftbar } else if (page.layout === 'post') { sidebar = site_tree.post.leftbar } else if (page.layout == null) { sidebar = site_tree.page.leftbar } else { sidebar = [] } if (topic?.leftbar) { sidebar = topic.leftbar } if (wiki?.leftbar) { sidebar = wiki.leftbar } page.leftbar = sidebar } // parse array string if (typeof page.leftbar == 'string') { page.leftbar = page.leftbar.replace(/ /g, '').split(','); } function layoutTitle(main, url, sub) { var el = ''; el += ''; el += '
' + main + '
'; if (sub) { let arr = sub.split('|'); if (arr.length > 1) { el += '
' + arr.shift().trim() + '
'; el += '
' + arr.join('|') + '
'; } else { el += '
' + sub + '
'; } } el += '
'; return el; } function layoutWidgets() { var el = ''; el += '
'; if (page.leftbar) { page.leftbar.forEach((w, i) => { let name = '' let widget = {} if (typeof w == 'string') { name = w } else if (typeof w == 'object' && w.override) { name = w.override } if (name in theme.widgets) { Object.assign(widget, theme.widgets[name]) } if (typeof w == 'object' && (w.override || w.layout)) { Object.assign(widget, w) } if (widget && widget.layout) { el += partial('../widgets/' + widget.layout, {item: widget}) } }); } el += '
'; return el; } function layoutFooterDiv() { const { social } = theme.footer if (social == null) { return '' } var el = '