From e34e1e0ff3548c185e2c1fd9c625e75e0f6ea9d6 Mon Sep 17 00:00:00 2001 From: Zen Visser Date: Fri, 17 Jan 2025 06:45:03 +0100 Subject: [PATCH 1/2] fix: only show files that are actually in the folder --- quartz/components/pages/FolderContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index 593073b96..f32663232 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -36,7 +36,7 @@ export default ((opts?: Partial) => { allFiles.forEach((file) => { const fileSlug = stripSlashes(simplifySlug(file.slug!)) - const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug + const prefixed = fileSlug.startsWith(`${folderSlug}/`) && fileSlug !== folderSlug const fileParts = fileSlug.split(path.posix.sep) const isDirectChild = fileParts.length === folderParts.length + 1 From 647218866e740b34ca77cd5982fecb25ba263b73 Mon Sep 17 00:00:00 2001 From: Zen Visser Date: Fri, 17 Jan 2025 20:42:36 +0100 Subject: [PATCH 2/2] fix: slightly cleaner solution to only showing files within the folder on folder pages --- quartz/components/pages/FolderContent.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index f32663232..926072d07 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -28,7 +28,7 @@ export default ((opts?: Partial) => { const FolderContent: QuartzComponent = (props: QuartzComponentProps) => { const { tree, fileData, allFiles, cfg } = props - const folderSlug = stripSlashes(simplifySlug(fileData.slug!)) + const folderSlug = simplifySlug(fileData.slug!) const folderParts = folderSlug.split(path.posix.sep) const allPagesInFolder: QuartzPluginData[] = [] @@ -36,7 +36,7 @@ export default ((opts?: Partial) => { allFiles.forEach((file) => { const fileSlug = stripSlashes(simplifySlug(file.slug!)) - const prefixed = fileSlug.startsWith(`${folderSlug}/`) && fileSlug !== folderSlug + const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug const fileParts = fileSlug.split(path.posix.sep) const isDirectChild = fileParts.length === folderParts.length + 1