From 0db8dbc51d20c52f337d2ada1187472ff51f6d63 Mon Sep 17 00:00:00 2001 From: heeyongKim <166043860+heeeeyong@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:41:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20GA=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=EB=B3=84=20title=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Layout.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/common/Layout.tsx b/src/components/common/Layout.tsx index f3d96e9f..4351819b 100644 --- a/src/components/common/Layout.tsx +++ b/src/components/common/Layout.tsx @@ -7,7 +7,26 @@ const Layout = () => { const location = useLocation(); useEffect(() => { - sendPageView(location.pathname + location.search + location.hash); + // 라우트별 페이지 타이틀 설정 + const path = location.pathname; + const titleRules: Array<[RegExp, string]> = [ + [/^\/$/, 'THIP - 로그인'], + [/^\/feed(\/|$)/, 'THIP - 피드'], + [/^\/notice(\/|$)/, 'THIP - 알림'], + [/^\/group(\/|$)/, 'THIP - 모임'], + [/^\/rooms\/[^/]+\/memory(\/|$)/, 'THIP - 기록장'], + [/^\/mypage(\/|$)/, 'THIP - 마이페이지'], + [/^\/search(\/|$)/, 'THIP - 책 검색'], + ]; + + const matched = titleRules.find(([regex]) => regex.test(path)); + if (matched) { + document.title = matched[1]; + } else { + document.title = 'THIP'; + } + + sendPageView(path + location.search + location.hash); }, [location.pathname, location.search, location.hash]); return (