This is an automated email from the ASF dual-hosted git repository. shuai pushed a commit to branch test in repository https://gitbox.apache.org/repos/asf/answer.git
commit d738ec2121f350dbfff8804c7b42b00fc820b152 Author: shuai <[email protected]> AuthorDate: Tue Sep 9 10:22:50 2025 +0800 feat: add /tags/:tagName/questions route --- i18n/en_US.yaml | 1 + ui/src/pages/Tags/Detail/index.tsx | 16 +++++++++++++--- ui/src/router/routes.ts | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 6803f196..8066f186 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -852,6 +852,7 @@ ui: http_50X: HTTP Error 500 http_403: HTTP Error 403 logout: Log Out + posts: Posts notifications: title: Notifications inbox: Inbox diff --git a/ui/src/pages/Tags/Detail/index.tsx b/ui/src/pages/Tags/Detail/index.tsx index 8bfd5ee8..dc475667 100644 --- a/ui/src/pages/Tags/Detail/index.tsx +++ b/ui/src/pages/Tags/Detail/index.tsx @@ -24,6 +24,7 @@ import { Link, useNavigate, useSearchParams, + useMatch, } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; @@ -65,6 +66,8 @@ const Index: FC = () => { tagInfo?.tag_id, tagInfo?.status, ); + const matchQuestions = useMatch('/tags/:tagName/questions'); + const matchPosts = useMatch('/tags/:tagName'); const toggleFollow = () => { if (!guard.tryNormalLogged(true)) { return; @@ -100,9 +103,16 @@ const Index: FC = () => { }, [tagResp, followResp]); let pageTitle = ''; if (tagInfo?.display_name) { - pageTitle = `'${tagInfo.display_name}' ${t('questions', { - keyPrefix: 'page_title', - })}`; + if (matchQuestions) { + pageTitle = `'${tagInfo.display_name}' ${t('questions', { + keyPrefix: 'page_title', + })}`; + } + if (matchPosts) { + pageTitle = `'${tagInfo.display_name}' ${t('posts', { + keyPrefix: 'page_title', + })}`; + } } const keywords: string[] = []; if (tagInfo?.slug_name) { diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index 3e324815..09ea4838 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -140,6 +140,10 @@ const routes: RouteNode[] = [ path: 'tags/:tagName', page: 'pages/Tags/Detail', }, + { + path: 'tags/:tagName/questions', + page: 'pages/Tags/Detail', + }, { path: 'tags/:tagName/info', page: 'pages/Tags/Info',
