diff --git a/_config.yml b/_config.yml index 00d74d9..686cdd2 100755 --- a/_config.yml +++ b/_config.yml @@ -24,9 +24,14 @@ sidebar: # friends: '[友链](/friends/)' # about: '[关于](/about/)' # Sidebar widgets + widget_layout: + index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages + page: [welcome, toc] # for pages using 'layout:page' + post: [toc, repo_info] # for pages using 'layout:post' + wiki: [toc, repo_info, wiki_more] # for pages using 'layout:wiki' widgets: # default layout in home/wiki/categories/tags/archives pages - default_layout: [welcome] + # default_layout: [welcome] # Recent update recent: layout: recent @@ -58,7 +63,7 @@ sidebar: ######## Main ######## breadcrumb: - home: config.title # config.title / config.author / home or custom content + home: home # config.title / config.author / home or custom content ######## Article ######## article: diff --git a/layout/404.ejs b/layout/404.ejs index f4b77e7..90cf4cd 100755 --- a/layout/404.ejs +++ b/layout/404.ejs @@ -16,6 +16,6 @@ page.robots = 'none'; <%- __('page.error.why') %>



- <%- __('page.error.action') %> + <%- __('page.error.action') %> <%- partial('_partial/plugins/comments/layout') %> diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index ab3828b..65ee1c8 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -2,16 +2,21 @@ // 默认组件 if (page.sidebar == undefined) { if (page.layout == 'post' && page.content) { - page.sidebar = ['toc', 'repo_info']; + page.sidebar = theme.sidebar.widget_layout.post; } else if (page.layout == 'wiki' && page.content && page.wiki) { let proj = theme.wiki.projects[page.wiki]; if (proj.sidebar) { page.sidebar = proj.sidebar; } else { - page.sidebar = ['toc', 'repo_info', 'wiki_more']; + page.sidebar = theme.sidebar.widget_layout.wiki; } + } else if (is_home() || ['categories', 'tags', 'archives', 'index', '404'].includes(page.layout)) { + page.sidebar = theme.sidebar.widget_layout.index; + } else if (page.layout == 'page') { + page.sidebar = theme.sidebar.widget_layout.page; } else { - page.sidebar = theme.sidebar.widgets.default_layout; + console.log('page.layout: ', page.layout); + page.sidebar = []; } } function layoutWidgets() { diff --git a/layout/_partial/sidebar/widgets/toc.ejs b/layout/_partial/sidebar/widgets/toc.ejs index 2b2b0a9..4a023cb 100644 --- a/layout/_partial/sidebar/widgets/toc.ejs +++ b/layout/_partial/sidebar/widgets/toc.ejs @@ -66,7 +66,7 @@ function layoutDiv(fallback) { el += '
'; if (page.layout !== 'wiki') { // post 布局 - el += layoutTocHeader(page.toc_title || __("meta.toc")); + el += layoutTocHeader(page.toc_title); el += '
'; el += '
'; el += layoutToc(); @@ -84,6 +84,7 @@ function layoutDiv(fallback) { }); } else { // 单 section + el += layoutTocHeader(page.toc_title); el += '
'; el += layoutDocTree(proj.pages); el += '
';