Skip to content

#127 - Fix docs nav: consistent hide:navigation and data-driven tab dropdowns#130

Merged
RamyaGuru merged 1 commit into
mainfrom
docs/fix-127-navigation-frontmatter
Jun 8, 2026
Merged

#127 - Fix docs nav: consistent hide:navigation and data-driven tab dropdowns#130
RamyaGuru merged 1 commit into
mainfrom
docs/fix-127-navigation-frontmatter

Conversation

@RamyaGuru
Copy link
Copy Markdown
Collaborator

Closes #127.

Problem

The Python API Usage page rendered a stray left sidebar (all its siblings hide it) and was missing from the top-level nav dropdown.

Root causes

  1. Five pages lacked the hide: navigation front matter their siblings carry:
    • docs/api-reference/python.md
    • docs/benchmarks/benchmarks.md
    • docs/benchmarks/raw_benchmarking.md
    • docs/benchmarks/socket_benchmarking.md
    • docs/tutorials/bare-metal-cmake-build.md
  2. The top-nav tab dropdowns were hand-mirrored from mkdocs.yml in tab-dropdowns.js and had drifted — missing the Python API Usage entry, and with no Benchmarking section at all.

Fix

  • Add hide: navigation to the five pages for consistency.
  • Replace the hardcoded dropdown map with a MkDocs hook (hooks/nav_dropdowns.py) that serializes the real nav into window.NV_NAV at build time. tab-dropdowns.js now consumes that, so the dropdowns stay in sync with mkdocs.yml automatically — no parallel list to maintain.

Verification

mkdocs build --strict passes; the injected window.NV_NAV contains all three multi-page sections (Benchmarking, API Reference incl. Python API Usage, Tutorials) with correct labels and URLs.

🤖 Generated with Claude Code

…ropdowns

Five pages lacked the `hide: navigation` front matter their siblings
carry, which left a stray sidebar on the Python API page. Add it to all
five for consistency.

The top-nav tab dropdowns were hand-mirrored from mkdocs.yml in
tab-dropdowns.js and had drifted (missing the Python API Usage entry, no
Benchmarking section). Replace the hardcoded map with a MkDocs hook
(hooks/nav_dropdowns.py) that serializes the real nav into window.NV_NAV
at build time, so the dropdowns stay in sync with mkdocs.yml
automatically.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Ramya Gurunathan <rgurunathan@nvidia.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 8, 2026

Greptile Summary

This PR fixes two related documentation navigation issues: five pages were missing hide: navigation front matter causing a stray sidebar, and the top-nav tab dropdowns were hardcoded in JavaScript and had drifted from mkdocs.yml. The fix adds the missing front matter and replaces the hardcoded dropdown map with a MkDocs hook that serializes the live nav into window.NV_NAV at build time.

  • Five markdown pages (docs/api-reference/python.md, three benchmarks pages, one tutorials page) each gain hide: navigation front matter to match their siblings.
  • hooks/nav_dropdowns.py is introduced as a new MkDocs hook; it captures multi-page sections in on_nav and injects window.NV_NAV into every page's <head> via on_post_page, so tab-dropdowns.js no longer needs a manually-maintained mirror of the nav.

Confidence Score: 5/5

Docs-only change with no impact on the C++ library, build system, or runtime behavior — safe to merge.

The hook correctly slots into MkDocs's event pipeline (on_nav fires before any on_post_page call, so the global is always populated before it is read). The str.format() call in on_post_page is safe because Python's format method only scans the template for replacement fields, not the argument values, so JSON braces in _NAV_JSON are never misinterpreted. The JavaScript side uses window.NV_NAV || {} as a safe fallback. DCO sign-off and correct commit title format are present.

No files require special attention.

Important Files Changed

Filename Overview
hooks/nav_dropdowns.py New MkDocs hook that serializes the nav into window.NV_NAV; logic and hook event ordering are correct
docs/javascripts/tab-dropdowns.js Hardcoded SECTIONS map replaced with window.NV_NAV; URL field rename from path to url is correctly applied
mkdocs.yml Adds hooks entry to register nav_dropdowns.py; no nav structure changes
docs/api-reference/python.md Adds hide: navigation front matter to match sibling pages
docs/benchmarks/benchmarks.md Adds hide: navigation front matter for sidebar consistency
docs/benchmarks/raw_benchmarking.md Adds hide: navigation front matter for sidebar consistency
docs/benchmarks/socket_benchmarking.md Adds hide: navigation front matter for sidebar consistency
docs/tutorials/bare-metal-cmake-build.md Adds hide: navigation front matter for sidebar consistency

Reviews (1): Last reviewed commit: "#127 - Fix docs nav: consistent hide:nav..." | Re-trigger Greptile

@RamyaGuru RamyaGuru merged commit 8b35548 into main Jun 8, 2026
3 checks passed
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.

Docs: Python API page navigation is broken; hide: navigation front matter is inconsistent across MkDocs pages

1 participant