Skip to content

Enforce relative internal links repo-wide (follow-up to #2546) #2547

Description

@ElliotFriend

Follow-up to #2546, which fixes absolute /docs/... links on the single Tier 1 Orgs page. That fix treats one symptom; this issue makes the fix stick repo-wide.

Background

Internal doc links should use relative ../path/file.mdx syntax with the file extension (Docusaurus docs), a convention already codified in docs/platforms/anchor-platform/CONTRIBUTING.md.

Why the existing CI doesn't catch this: the pull_request workflow (main.yml) runs two relevant jobs, and neither flags absolute-but-valid internal links:

  • mdx-formatpnpm ci:mdx is prettier — it checks formatting, not link style. /docs/foo and ../foo.mdx are equally "formatted."
  • buildpnpm build with onBrokenLinks: "throw" only fails on dead routes. An absolute /docs/... link that resolves to a valid page is not broken, so it passes.

Result: absolute internal links pointing at pages that exist sail through CI today. There are currently ~22 occurrences across 7 files (grep -rn '](/docs' docs/).

Sub-tasks

  • 1. Batch-sweep remaining files. Convert absolute ](/docs...) links to relative .mdx links in the other 6 files (Tier 1 Orgs handled in Link to MDX files on Tier 1 Orgs page #2546): docs/validators/README.mdx, docs/validators/admin-guide/configuring.mdx, docs/validators/admin-guide/prerequisites.mdx, docs/validators/admin-guide/publishing-history-archives.mdx, docs/tools/lab/transaction-dashboard.mdx, docs/platforms/anchor-platform/CONTRIBUTING.md. Preserve any #anchors.
  • 2. Add automated checks (do this after the sweep, or the repo-wide check fails the PR that adds it):
    • CI gate (enforcement): a repo-wide step in the mdx-format job of main.yml that fails if grep -rn '](/docs' docs/ finds anything. Unbypassable, setup-independent — this is the guarantee.
    • Pre-commit hint (ergonomics): a staged-files-only check appended to the existing .husky/pre-commit hook, so contributors with the repo set up catch it before the slow CI round-trip. Scoped to staged files so pre-existing debt in untouched files never blocks unrelated commits.

The CI gate is the real gate; the pre-commit hook is a fast-feedback convenience layered on top.

Scope note

Limit the check to ](/docs specifically for now. There are ~155 bare root-relative ](/...) links (non-docs, e.g. lab slugs) that may be intentional and need separate evaluation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions