From 8d073b46a129ae2f46e2b6eecb1bc3910a6e2385 Mon Sep 17 00:00:00 2001 From: pucedoteth <119044801+pucedoteth@users.noreply.github.com> Date: Sat, 5 Sep 2026 00:54:55 +0200 Subject: [PATCH] fix(toc): point "Edit this page on GitHub" at the current page `Toc` declares a `filePath` prop (Nextra passes the page's project-root relative path, e.g. `src/pages/general/rpc.mdx`) but never destructures it. The link instead used `URLS.editDocsOnGithub`, a constant set to `https://github.com/inkonchain`, so on every page the "Edit this page on GitHub" link dropped the reader on the GitHub organization landing page rather than an editor for the page they were reading. Use the prop to build the real edit URL and rename the constant to `editDocsOnGithubBase` to reflect that it is now a base, falling back to the repository URL when `filePath` is empty. Co-Authored-By: Claude Opus 5 --- src/components/Toc.tsx | 12 +++++++----- src/utils/urls.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Toc.tsx b/src/components/Toc.tsx index 957cfb5f..ed8ceb37 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 b7a6fab9..12101b18 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", };