T-G5ND-site-generated-sidebar
Status: closed/done · Impact: high · Complexity: medium
Make the nav generated: expand site/site.yaml’s ordered slots into
site/src/generated/sidebar.mjs so astro.config.mjs keeps only
site identity and an import.
D-0010-deterministic-site-assembly §3.
| Location | Role today |
|---|---|
site/astro.config.mjs | Hand-maintained sidebar plus the Appendix splice |
site/src/generated/appendix_sidebar.mjs | Generated anchor children for Glossary/References only |
site/src/routeData.ts | TOC injection hardcoded to the two Appendix rosters |
Proposed
Section titled “Proposed”nav.ts in the docs service expands each manifest slot —
generated: keys to their groups/pages (reference, appendix,
data-model; planning and roadmap land with their phases),
file:/group: entries to links and two-level groups in declared
order — and emits one sidebar.mjs module. appendix_sidebar.mjs
folds in. routeData.ts generalizes: roster TOC entries come from
the same module keyed by route, not hardcoded ids. Nav labels
register through the P1 registries.
Approach
Section titled “Approach”nav.ts: slot-expansion table, label registration,sidebar.mjsemission (module emission stays string-built per D-0010 §6).- Reduce
astro.config.mjsto identity + import. - Fold
appendix_sidebar.mjsinto the new module; delete it. - Generalize
routeData.tsto a route-keyed lookup. - Tests: slot-expansion fixtures, label-collision fixture; site build green.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/services/docs/site/nav.ts | new | Slot expansion + emission |
site/src/generated/sidebar.mjs | new | Generated artifact |
site/src/generated/appendix_sidebar.mjs | delete | Folds into sidebar.mjs |
site/astro.config.mjs | modify | Thin shell |
site/src/routeData.ts | modify | Route-keyed TOC lookup |
plugin/lib/services/docs/tests/ | modify | Nav suites |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1:
astro.config.mjscontains no nav labels or slugs beyond thesidebar.mjsimport. - AC-2: Reordering slots in
site.yamlreorders the rendered sidebar with no config edit. - AC-3: Two same-level nav entries with one label fail with exit 7.
- AC-4: Site builds with sidebar and Appendix TOC behavior unchanged from the D-0009 P6 baseline.
Out of scope
Section titled “Out of scope”- The
planningandroadmapslot expansions — they ship with T-I6WC-site-corpus-curated-types and T-9LHH-site-roadmap-generated.
Dependencies
Section titled “Dependencies”- T-R733-site-manifest-routes-ownership — manifest and registries.
Discovery context
Section titled “Discovery context”Extracted from D-0010-deterministic-site-assembly Migration Phase 2.
Depends on
Section titled “Depends on”T-R733-site-manifest-routes-ownership