gitbook导航文件夹悬停自动展开

This commit is contained in:
tangly1024
2024-09-21 23:04:56 +08:00
parent ca58e15f29
commit 80c7b505da
3 changed files with 15 additions and 3 deletions

View File

@@ -105,6 +105,7 @@ function groupArticles(filteredNavPages) {
return []
}
const groups = []
const AUTO_SORT = siteConfig('GITBOOK_AUTO_SORT', true, CONFIG)
for (let i = 0; i < filteredNavPages.length; i++) {
const item = filteredNavPages[i]
@@ -112,7 +113,7 @@ function groupArticles(filteredNavPages) {
let existingGroup = null
// 开启自动分组排序将同分类的自动归到同一个文件夹忽略Notion中的排序
if (siteConfig('GITBOOK_AUTO_SORT', true, CONFIG)) {
if (AUTO_SORT) {
existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组
} else {
existingGroup = groups[groups.length - 1] // 获取最后一个分组