From 265faef4e8717eab9678a5515ca9150b7776b148 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Mon, 17 Jun 2024 21:43:32 -0700 Subject: [PATCH] fix: properly compute relative path for explorer (closes #1055, #1066) --- quartz/components/ExplorerNode.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx index 2968a03..e57d677 100644 --- a/quartz/components/ExplorerNode.tsx +++ b/quartz/components/ExplorerNode.tsx @@ -168,10 +168,8 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro const isDefaultOpen = opts.folderDefaultState === "open" // Calculate current folderPath - let folderPath = "" - if (node.name !== "") { - folderPath = joinSegments(fullPath ?? "", node.name) - } + const folderPath = node.name !== "" ? joinSegments(fullPath ?? "", node.name) : "" + const href = resolveRelative(fileData.slug!, folderPath as SimpleSlug) + "/" return ( <> @@ -205,11 +203,7 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro {/* render tag if folderBehavior is "link", otherwise render