[opt] widgets default layout

This commit is contained in:
xaoxuu 2022-11-19 02:24:53 +08:00
parent f788b3938c
commit 79e380b4ee
2 changed files with 10 additions and 4 deletions

View File

@ -25,10 +25,10 @@ sidebar:
# about: '[关于](/about/)' # about: '[关于](/about/)'
# Sidebar widgets # Sidebar widgets
widgets: widgets:
index: [welcome, recent, timeline] # for home/wiki/categories/tags/archives/404 pages index: welcome, recent, timeline # for home/wiki/categories/tags/archives/404 pages
page: [welcome, toc] # for pages using 'layout:page' page: welcome, toc # for pages using 'layout:page'
post: [toc, ghrepo, ghissues] # for pages using 'layout:post' post: toc, ghrepo, ghissues # for pages using 'layout:post'
wiki: [toc, ghrepo, ghissues, related] # for pages using 'layout:wiki' wiki: toc, ghrepo, ghissues, related # for pages using 'layout:wiki'
######## Index ######## ######## Index ########
post-index: # 近期发布 分类 标签 归档 and ... post-index: # 近期发布 分类 标签 归档 and ...

View File

@ -18,6 +18,12 @@ if (page.sidebar == undefined) {
page.sidebar = []; page.sidebar = [];
} }
} }
// parse array string
if (typeof page.sidebar == 'string') {
page.sidebar = page.sidebar.replace(/ /g, '').split(',');
}
function layoutWidgets() { function layoutWidgets() {
var el = ''; var el = '';
el += '<div class="widgets">'; el += '<div class="widgets">';