From 6e058ad45dbe375389365987fac8c3e6c167824b Mon Sep 17 00:00:00 2001 From: IBRAHIM IBRAHIM <66755652+Ibrahim2595@users.noreply.github.com> Date: Thu, 24 Sep 2026 15:10:08 -0400 Subject: [PATCH] Fix: resolve "Edit this page" to the repo that holds each docs version #2584 "Edit this page" returned a 404 on every page of the published v0.7 documentation. The link pointed at rossoctl/rossoctl/tree/main/docs/versioned_docs/version-0.7/..., a path that does not exist in that repository: the versioned snapshots are committed here, in rossoctl/.github, beside the site. editUrl was a single string pointing at rossoctl/rossoctl. That is correct for the dev version, whose pages are mirrored from that repository's docs/ tree by scripts/sync-docs.sh, and wrong for every released version. Because the string applies to all versions, the contribution path was closed for the whole latest version: a reader who found a typo on a released page could not reach the source. Make editUrl a function of the version. A page in the current (dev) version resolves to rossoctl/rossoctl:docs/; a page in a versioned snapshot resolves to this repository, using versionDocsDirPath as the prefix. versionDocsDirPath is the version's content root relative to the site directory, so it is already 'versioned_docs/version-X.Y' for a release and needs no version hard-coded here. The next release therefore needs no change to this callback. Verified against a production build: every one of the 20 v0.7 pages resolves to a file in versioned_docs/version-0.7/, and every one of the 45 dev pages resolves to a file in rossoctl/rossoctl:docs/. The 7 remaining pages are generated category indexes, which have no source file and correctly render no link. Assisted-By: Claude (Anthropic AI) Signed-off-by: IBRAHIM IBRAHIM <66755652+Ibrahim2595@users.noreply.github.com> --- docusaurus.config.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index dcbde74..2d9b2d3 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -85,8 +85,22 @@ const config: Config = { path: 'docs', routeBasePath: 'docs', sidebarPath: './sidebars.ts', - // "Edit this page" points at the source of truth upstream. - editUrl: 'https://github.com/rossoctl/rossoctl/tree/main/docs/', + // "Edit this page" has to resolve per version, because the two + // versions live in DIFFERENT repositories (#2584): + // dev -> rossoctl/rossoctl:docs/ — the source of truth, mirrored + // into docs/ here at build time by scripts/sync-docs.sh. + // vX.Y -> this repo: `docusaurus docs:version` writes the snapshot + // to versioned_docs/version-X.Y/, and it is committed here. + // A plain string cannot express that. Pointing every version at + // rossoctl/rossoctl sent every released page to a path that does not + // exist there, so "Edit this page" 404'd on the whole latest version. + // `versionDocsDirPath` is the version's content root relative to this + // site directory ('docs' for dev, 'versioned_docs/version-X.Y' for a + // release), which is exactly the in-repo prefix the snapshot needs. + editUrl: ({version, versionDocsDirPath, docPath}) => + version === 'current' + ? `https://github.com/rossoctl/rossoctl/tree/main/docs/${docPath}` + : `https://github.com/rossoctl/.github/tree/main/${versionDocsDirPath}/${docPath}`, // Versioning: the current (un-versioned) docs are the in-progress // "dev" docs, shown in the header version dropdown. No released // versions exist yet. When the first is cut