filterFn 그지같네
This commit is contained in:
+2
-48
@@ -38,30 +38,7 @@ export const defaultContentPageLayout: PageLayout = {
|
|||||||
{ Component: Component.ReaderMode() },
|
{ Component: Component.ReaderMode() },
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
Component.Explorer({
|
Component.Explorer(),
|
||||||
filterFn: (node) => {
|
|
||||||
// 1. 숨기고 싶은 키워드 (index.md의 title에 적은 것과 폴더명 모두 포함)
|
|
||||||
const omitWords = ["extra", "template", "note", "volume"]
|
|
||||||
|
|
||||||
// 파일(페이지)은 기본적으로 보여줍니다.
|
|
||||||
if (node.file) return true
|
|
||||||
|
|
||||||
// 2. node가 가진 다양한 이름 속성들을 싹 다 긁어모읍니다.
|
|
||||||
const namesToCheck = [
|
|
||||||
node.name,
|
|
||||||
node.displayName,
|
|
||||||
node.file?.frontmatter?.title // index.md가 있다면 그 안의 title까지
|
|
||||||
]
|
|
||||||
|
|
||||||
// 3. 하나라도 omitWords에 포함되어 있는지 확인합니다.
|
|
||||||
const shouldOmit = namesToCheck.some(name => {
|
|
||||||
const lowerName = name?.toLowerCase() ?? ""
|
|
||||||
return omitWords.some(word => lowerName.includes(word))
|
|
||||||
})
|
|
||||||
|
|
||||||
return !shouldOmit
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
right: [
|
right: [
|
||||||
Component.Graph(),
|
Component.Graph(),
|
||||||
@@ -85,30 +62,7 @@ export const defaultListPageLayout: PageLayout = {
|
|||||||
{ Component: Component.Darkmode() },
|
{ Component: Component.Darkmode() },
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
Component.Explorer({
|
Component.Explorer(),
|
||||||
filterFn: (node) => {
|
|
||||||
// 1. 숨기고 싶은 키워드 (index.md의 title에 적은 것과 폴더명 모두 포함)
|
|
||||||
const omitWords = ["extra", "template", "note", "volume"]
|
|
||||||
|
|
||||||
// 파일(페이지)은 기본적으로 보여줍니다.
|
|
||||||
if (node.file) return true
|
|
||||||
|
|
||||||
// 2. node가 가진 다양한 이름 속성들을 싹 다 긁어모읍니다.
|
|
||||||
const namesToCheck = [
|
|
||||||
node.name,
|
|
||||||
node.displayName,
|
|
||||||
node.file?.frontmatter?.title // index.md가 있다면 그 안의 title까지
|
|
||||||
]
|
|
||||||
|
|
||||||
// 3. 하나라도 omitWords에 포함되어 있는지 확인합니다.
|
|
||||||
const shouldOmit = namesToCheck.some(name => {
|
|
||||||
const lowerName = name?.toLowerCase() ?? ""
|
|
||||||
return omitWords.some(word => lowerName.includes(word))
|
|
||||||
})
|
|
||||||
|
|
||||||
return !shouldOmit
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
right: [],
|
right: [],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user