diff --git a/layout/_partial/sidebar/widgets/toc.ejs b/layout/_partial/sidebar/widgets/toc.ejs index 0877528..3fd1f7a 100644 --- a/layout/_partial/sidebar/widgets/toc.ejs +++ b/layout/_partial/sidebar/widgets/toc.ejs @@ -30,7 +30,7 @@ function layoutDocTree(pages) { el += '
'; if (proj.pages.length > 1) { let href = url_for(p.path); - if (i == 0) { + if (p.is_homepage) { href += '#start' } el += ''; diff --git a/scripts/events/lib/doc_tree.js b/scripts/events/lib/doc_tree.js index e98d955..18830dd 100644 --- a/scripts/events/lib/doc_tree.js +++ b/scripts/events/lib/doc_tree.js @@ -95,6 +95,7 @@ module.exports = ctx => { continue } proj.homepage = proj_pages[0] + proj.homepage.is_homepage = true // 内页按 section 分组 var section_configs = [] if (proj.sections) {