Repository navigation
Fix: resolve "Edit this page" to the repository that holds each docs version - #124
Merged
Merged
Conversation
…n #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) <noreply@anthropic.com> Signed-off-by: IBRAHIM IBRAHIM <66755652+Ibrahim2595@users.noreply.github.com>
✅ Deploy Preview for animated-crumble-fb8862 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes rossoctl/rossoctl#2584.
"Edit this page" returns a 404 on every page of the published v0.7 documentation. On
Install for laptop the link resolves to:
That path does not exist in
rossoctl/rossoctl. The versioned snapshots are committed here, inrossoctl/.github, beside the site.editUrlwas one string pointing atrossoctl/rossoctl. That is right fordev, whose pages aremirrored from that repository's
docs/tree byscripts/sync-docs.sh, and wrong for every releasedversion. Because one string applies to all versions, the contribution path was closed for the whole
latestversion — a reader who finds a typo on a released page cannot reach the source.What changed
editUrlbecomes a function of the version:version === 'current'(thedevdocs) →rossoctl/rossoctl:docs/<docPath>, unchanged behaviour.<versionDocsDirPath>/<docPath>.versionDocsDirPathis the version's content root relative to the site directory, so it is alreadyversioned_docs/version-X.Yfor a release. No version is hard-coded, which means the next releaseneeds no change to this callback — consistent with how the rest of the version map is derived from
versions.json.One file changed,
docusaurus.config.ts. No content, no routing and no version map changes.Verification
Against a production build (
npm run sync-docs && npm run build), following the two steps in theissue:
rossoctl/.github→versioned_docs/version-0.7/…rossoctl/rossoctl→docs/…Every one of the 65 rendered links was mapped back to a file and checked for existence, rather than
only checked for the right shape. The 7 pages with no link are generated category indexes, which have
no source file and correctly render none.
npx tsc --noEmit: clean. Build: no errors, no new warnings.Spot check of the previously broken URL, before and after:
Note
The issue lists two adjacent gaps in the v0.7 content (no laptop section in
users-guides/troubleshooting.md,no feedback section in
getting-started/install-local.md). Those are content in a frozen snapshot andare out of scope here; they are addressed by cutting a release from the current
devtree, which isthe follow-up to this PR.
Separately, the
contributingdocs instance in this same file has aneditUrlpointing atIbrahim2595/rossoctl-website, a repository that does not exist, so "Edit this page" on/contributing/is also dead. It is the same class of bug but a different plugin and a differenttarget, so it is left for its own PR rather than bundled here.
Assisted-By: Claude Code