Runbook: In-page “On this page” sidebar missing or empty
Trigger
-
A long HTML page under
docs/(notdocs/api/) has no “On this page” list, or the list is empty. -
You expect a main column plus a right-hand (or stacked) table of contents from
docs/assets/docs-nav.js.
Fast triage
-
The page loads
<script defer src="…/assets/docs-nav.js"></script>(Network tab: no 404 fordocs-nav.js). -
JavaScript is on. For
file://URLs some browsers block scripts; use a small server, e.g.cd docs && python -m http.server 8765. -
Console: no errors from
docs-nav.jsbefore the layout runs. -
After load,
<div id="docs-top-nav">still exists (the script fills it; it should not disappear). It should contain<nav class="top-nav">. -
The page uses
<main class="container">and<div id="docs-top-nav">; the script can add the TOC mount for you.
Most common causes
-
Wrong page shell — Auto TOC needs
<main class="container">and#docs-top-nav. -
No headings — TOC lists
h2/h3(addsidif missing).p.leadis not listed. -
Broken markup — The script sets
idfrom heading text; bad HTML around a heading can hide it. -
Diagram headings —
h3insidefigure.sys-diagram/.sys-diagramis skipped. - Long list — Many headings still use one mount; the sidebar scrolls. To hide the sidebar on one page, remove that page’s mount only.
-
Two TOCs — Old
Contentsblocks are removed bydocs-nav.js; keep only the generated “On this page”.
Recovery steps
-
Ensure page shell is correct:
<main class="container">with<div id="docs-top-nav"></div>near the top (see Documentation pipeline → In-page “On this page” sidebar). -
Ensure each section you want in the TOC has an
h2orh3with a stableid(or let the script generate one from heading text). -
Use clear
h2/h3structure. Cards do not change which headings appear. -
Run
make docs-fixso HTML normalization stays consistent, thenmake docs-check.
Exit criteria
- “On this page” lists the right sections; the active link updates as you scroll.
- No console errors from
docs-nav.json that page.
Page history
| Date | Change | Author |
|---|---|---|
| Added Page history section (repository baseline). | Ivan Boyarkin |