From 9c41b2f95d13d60ad61cbf63d2d0eacd6f2b9117 Mon Sep 17 00:00:00 2001 From: jungwoo choi Date: Sat, 14 Feb 2026 07:26:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8A=B8=EB=A6=AC=20=EB=85=B8=EB=93=9C?= =?UTF-8?q?=EC=97=90=20=EB=A7=88=EC=A7=80=EB=A7=89=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=84=B8=EA=B7=B8=EB=A8=BC=ED=8A=B8=EB=A7=8C=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /about/press → press, /about → about, / → / 들여쓰기로 계층이 표현되므로 전체 경로 반복 불필요 Co-Authored-By: Claude Opus 4.6 --- .../site-inspection/PageTreeNode.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/site-inspection/PageTreeNode.tsx b/frontend/src/components/site-inspection/PageTreeNode.tsx index ed50c3a..dba5f20 100644 --- a/frontend/src/components/site-inspection/PageTreeNode.tsx +++ b/frontend/src/components/site-inspection/PageTreeNode.tsx @@ -29,14 +29,20 @@ interface PageTreeNodeProps { } /** - * URL에서 도메인을 제거하고 경로만 반환. - * 예: "https://example.com/about" -> "/about" + * URL에서 마지막 경로 세그먼트만 반환. + * 루트는 "/", 나머지는 마지막 세그먼트만 표시. + * 예: "https://example.com/" -> "/" + * "https://example.com/about" -> "about" + * "https://example.com/about/press" -> "press" */ -function getPathFromUrl(url: string): string { +function getDisplayName(url: string): string { try { const parsed = new URL(url); - const path = parsed.pathname + parsed.search; - return path || "/"; + const path = parsed.pathname; + if (path === "/" || path === "") return "/"; + const clean = path.endsWith("/") ? path.slice(0, -1) : path; + const segments = clean.split("/").filter(Boolean); + return segments[segments.length - 1] || "/"; } catch { return url; } @@ -55,7 +61,7 @@ export function PageTreeNode({ const children = childrenPages.get(page.url) || []; const hasChildren = children.length > 0; const isSelected = selectedUrl === page.url; - const displayPath = getPathFromUrl(page.url); + const displayPath = getDisplayName(page.url); return (