Skip to content

fix(docs): recurse into docs subdirectories when preparing for Docusaurus#32

Merged
chrisns merged 1 commit into
mainfrom
fix/prepare-docs-recurse
Apr 28, 2026
Merged

fix(docs): recurse into docs subdirectories when preparing for Docusaurus#32
chrisns merged 1 commit into
mainfrom
fix/prepare-docs-recurse

Conversation

@chrisns
Copy link
Copy Markdown
Member

@chrisns chrisns commented Apr 28, 2026

Summary

  • website/scripts/prepare-docs.js used a non-recursive readdirSync and only copied top-level .md files from docs/ into website/docs/. The recently merged docs/adr/ section was silently skipped, so the ADR pages 404 on the published site even though the build succeeded.
  • Walk the source tree recursively, preserving directory structure into website/docs/. For nested files, omit the explicit id frontmatter so Docusaurus derives both the id and the route from the file path — the cleanest way to give nested docs unique URLs without hitting Docusaurus's "id cannot include slash" rule.
  • Top-level docs are unchanged (explicit id retained), so this is backward-compatible: existing URLs do not move.

Verified locally

npm run build in website/ succeeds and produces:

  • /docs/adr rendering docs/adr/README.md (the ADR section landing page).
  • /docs/adr/aws-identity-center rendering docs/adr/0001-aws-identity-center.md. The 0001- numeric prefix is stripped per Docusaurus's autogenerated-sidebar convention.

The user-typed URL /docs/adr/README.md was never going to resolve — Docusaurus serves HTML, not raw .md files. Internal links in the ADR README still use ./*.md so they continue to work on GitHub's file browser.

Test plan

…urus

The Docusaurus prepare step at website/scripts/prepare-docs.js used a
non-recursive readdirSync over docs/, so it silently skipped any
subdirectory. The recently merged docs/adr/ section therefore never
reached the published site, despite the build appearing to succeed.

Recurse the source tree, preserving directory structure on the way to
website/docs/. For nested files we omit explicit `id` frontmatter so
that Docusaurus derives both the id and the route from the file's path,
which is the cleanest way to give nested docs unique URLs without
hitting Docusaurus's "id cannot include slash" rule. Top-level docs
keep their explicit id and existing URL, so this is a backward-
compatible change.

Verified locally with `npm run build` in website/: docs/adr/README.md
now renders at /docs/adr and docs/adr/0001-aws-identity-center.md at
/docs/adr/aws-identity-center.
@chrisns chrisns added this pull request to the merge queue Apr 28, 2026
Merged via the queue into main with commit b2e3556 Apr 28, 2026
2 checks passed
@chrisns chrisns deleted the fix/prepare-docs-recurse branch April 28, 2026 09:43
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