Skip to content

fix(docs): repair broken "SEE ALSO" links on CLI reference pages#49

Merged
dcmcand merged 1 commit into
mainfrom
fix/cli-reference-see-also-links
Jul 7, 2026
Merged

fix(docs): repair broken "SEE ALSO" links on CLI reference pages#49
dcmcand merged 1 commit into
mainfrom
fix/cli-reference-see-also-links

Conversation

@dcmcand

@dcmcand dcmcand commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The bug

Every CLI reference page's SEE ALSO section linked to sibling/parent commands using cobra's default <command>.md targets, e.g.:

<a href="frames_auth_login.md">frames auth login</a>

Starlight serves those pages at extensionless, trailing-slash routes (/reference/cli/frames_auth_login/). A relative frames_auth_login.md on the page at /reference/cli/frames_auth/ resolves to /reference/cli/frames_auth/frames_auth_login.md -> 404. So every "See also" link was dead. (The left sidebar was fine - Starlight builds those from slugs; only the in-content cobra links were broken.)

Root cause

tools/docs-gen/main.go passed the identity function as cobra/doc's linkHandler, so the .md targets were emitted verbatim. The site's remark-base-links plugin only rewrites root-absolute links (/...), so it left these relative .md links untouched.

This is pre-existing and independent of the theme/runtime work in the other open PRs.

The fix

Replace the identity handler with one that maps <command>.md -> /reference/cli/<command>/ (root-absolute). remark-base-links then prepends the deployment base path, exactly like every other content link on the site. The URL prefix is derived from outDir so it can't drift.

  • Regenerated all 13 CLI reference pages (only the SEE ALSO links changed).
  • Added a table-driven unit test pinning the <command>.md -> route mapping.

Verification

  • go test ./... passes (incl. the new docs-gen test); go vet clean; generator output is still byte-for-byte deterministic (the "CLI reference is up to date" CI check stays green).
  • Production-base build (BASE=/nebari-frames/): SEE ALSO links now render as /nebari-frames/reference/cli/<command>/, with zero .md hrefs remaining in any built CLI page, and they match the actual page routes.

Before -> after (rendered):

href="frames_auth_login.md"  ->  href="/nebari-frames/reference/cli/frames_auth_login/"

The link handler passed to cobra/doc was the identity function, so each
command page's "SEE ALSO" section kept cobra's default "<command>.md"
targets (e.g. frames_auth_login.md). Starlight serves those pages at
extensionless, trailing-slash routes (/reference/cli/frames_auth_login/),
and the site's remark-base-links plugin only rewrites root-absolute links,
so the relative ".md" links resolved against the current page and 404'd.

Replace the identity handler with one that maps "<command>.md" to the
root-absolute route "/reference/cli/<command>/". remark-base-links then
prepends the deployment base path, matching every other content link.
Regenerate the pages and add a table-driven test pinning the mapping.

Verified with a production-base build: the SEE ALSO links now render as
/nebari-frames/reference/cli/<command>/ with no ".md" hrefs remaining.
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

📄 Docs preview for fix/cli-reference-see-also-links:
https://fix-cli-reference-see-also-l.nebari-frames.pages.dev

@dcmcand dcmcand merged commit d8b29f4 into main Jul 7, 2026
6 checks passed
@dcmcand dcmcand deleted the fix/cli-reference-see-also-links branch July 7, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant