diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index 80ecf8a..8b137ee 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -3,8 +3,13 @@ if (page.sidebar == undefined) { if (page.layout == 'post' && page.content) { page.sidebar = ['toc', 'repo_info']; - } else if (page.layout == 'wiki' && page.content) { - page.sidebar = ['toc', 'repo_info', 'wiki_more']; + } 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']; + } } else { page.sidebar = theme.sidebar.widgets.default_layout; } diff --git a/layout/_partial/sidebar/widgets/toc.ejs b/layout/_partial/sidebar/widgets/toc.ejs index b5e275b..cb4a390 100644 --- a/layout/_partial/sidebar/widgets/toc.ejs +++ b/layout/_partial/sidebar/widgets/toc.ejs @@ -1,4 +1,6 @@ <% +let proj = theme.wiki.projects[page.wiki]; + function layoutToc() { if (toc(page.content).length > 0) { return toc(page.content, { @@ -9,79 +11,91 @@ function layoutToc() { } return ''; } -function layoutDiv(fallback) { - var t = ''; - if (page.layout == 'post' && page.content) { - let toc_content = toc(page.content); - if (toc_content && toc_content.length > 0) { - t = page.layout; - } - } else if (page.layout == 'wiki') { - t = page.layout; - } else if (page.sidebar.includes('toc') == true) { - t = page.layout; - } + +function layoutTocHeader(title) { var el = ''; - if (t.length > 0) { - el += '