diff --git a/src/components/Toc.tsx b/src/components/Toc.tsx index 957cfb5..ed8ceb3 100644 --- a/src/components/Toc.tsx +++ b/src/components/Toc.tsx @@ -10,7 +10,12 @@ interface TocProps { filePath: string; } -export const Toc: React.FC = ({ toc: headings }) => { +export const Toc: React.FC = ({ toc: headings, filePath }) => { + // `filePath` is relative to the project root, e.g. "src/pages/general/rpc.mdx" + const editUrl = filePath + ? `${URLS.editDocsOnGithubBase}/${filePath}` + : URLS.repositoryUrl; + return (
{headings.length > 0 && ( @@ -31,10 +36,7 @@ export const Toc: React.FC = ({ toc: headings }) => {
)}
- + Edit this page on GitHub diff --git a/src/utils/urls.ts b/src/utils/urls.ts index b7a6fab..12101b1 100644 --- a/src/utils/urls.ts +++ b/src/utils/urls.ts @@ -6,5 +6,5 @@ export const URLS = { repositoryUrl: "https://github.com/inkonchain/docs", developerWaitlistUrl: "https://inkonchain.com", feedbackUrl: "https://inkonchain.com", - editDocsOnGithub: "https://github.com/inkonchain", + editDocsOnGithubBase: "https://github.com/inkonchain/docs/edit/main", };