From 647218866e740b34ca77cd5982fecb25ba263b73 Mon Sep 17 00:00:00 2001 From: Zen Visser Date: Fri, 17 Jan 2025 20:42:36 +0100 Subject: [PATCH] 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