fix: dont show index page for folder in its own listing

This commit is contained in:
Jacky Zhao 2023-08-20 15:02:24 -07:00
parent 4aa80e0426
commit 3eba87a512

View File

@ -12,7 +12,7 @@ function FolderContent(props: QuartzComponentProps) {
const { tree, fileData, allFiles } = props const { tree, fileData, allFiles } = props
const folderSlug = _stripSlashes(simplifySlug(fileData.slug!)) const folderSlug = _stripSlashes(simplifySlug(fileData.slug!))
const allPagesInFolder = allFiles.filter((file) => { const allPagesInFolder = allFiles.filter((file) => {
const fileSlug = simplifySlug(file.slug!) const fileSlug = _stripSlashes(simplifySlug(file.slug!))
const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug
const folderParts = folderSlug.split(path.posix.sep) const folderParts = folderSlug.split(path.posix.sep)
const fileParts = fileSlug.split(path.posix.sep) const fileParts = fileSlug.split(path.posix.sep)