From 360acbc11d06b707b10ae92e7b13ff62d6b73fd1 Mon Sep 17 00:00:00 2001 From: ThyeeZz Date: Thu, 10 Oct 2024 19:21:38 +0800 Subject: [PATCH] fix broken link in commit info --- src/components/language-selector/LanguageSelector.tsx | 4 ++-- src/http/hooks.js | 4 +++- src/pages/api-reference/[language]/[version]/[...slug].tsx | 1 + src/parts/docs/GitCommitInfo.jsx | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/language-selector/LanguageSelector.tsx b/src/components/language-selector/LanguageSelector.tsx index 25e9d0309..4046a4cc0 100644 --- a/src/components/language-selector/LanguageSelector.tsx +++ b/src/components/language-selector/LanguageSelector.tsx @@ -37,7 +37,7 @@ const LanguageIcon = ({ className }: { className?: string }) => { fill="none" className={className} > - + { diff --git a/src/http/hooks.js b/src/http/hooks.js index 4a3fa3378..a7ac9d95c 100644 --- a/src/http/hooks.js +++ b/src/http/hooks.js @@ -20,7 +20,9 @@ export function useGithubCommits({ commitPath, version }) { const date = lastCommit.commit.committer.date; const commitUrl = lastCommit.html_url; const formatDate = dayjs(date).format('YYYY-MM-DD HH:mm:ss'); - const source = `https://github.com/milvus-io/milvus-docs/blob${commitPath}`; + const source = commitPath.startWidth('http') + ? commitPath + : `https://github.com/milvus-io/milvus-docs/blob${commitPath}`; setCommitInfo({ commitUrl, date: formatDate, source, message }); } } catch (error) { diff --git a/src/pages/api-reference/[language]/[version]/[...slug].tsx b/src/pages/api-reference/[language]/[version]/[...slug].tsx index 977a94ae5..b85aab8d7 100644 --- a/src/pages/api-reference/[language]/[version]/[...slug].tsx +++ b/src/pages/api-reference/[language]/[version]/[...slug].tsx @@ -206,6 +206,7 @@ export default function Template(props: ApiDetailPageProps) { version={version} htmlContent={doc} mdId={currentId} + commitPath={apiReferenceData.editPath} type="api" /> diff --git a/src/parts/docs/GitCommitInfo.jsx b/src/parts/docs/GitCommitInfo.jsx index 1d433c6a2..62c4a168b 100644 --- a/src/parts/docs/GitCommitInfo.jsx +++ b/src/parts/docs/GitCommitInfo.jsx @@ -3,6 +3,7 @@ import classes from './gitCommit.module.less'; export default function GitCommitInfo(props) { const { commitInfo = {}, mdId, commitTrans = 'was last updated at' } = props; + return (