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 (