Skip to content

Navigation: use content hash for sidebar tree IDs - #3750

Open
reakaleek wants to merge 2 commits into
mainfrom
cursor/0e6c827b
Open

Navigation: use content hash for sidebar tree IDs#3750
reakaleek wants to merge 2 commits into
mainfrom
cursor/0e6c827b

Conversation

@reakaleek

Copy link
Copy Markdown
Member

What

  • Give each sidebar navigation tree a unique nav-tree-* id based on its rendered content, not the navigation root id
  • Build navigation HTML from a render model so templates no longer depend on domain navigation types
  • Cache rendered navigation once per navigation root during a build

Why

  • Different pages can show different sidebars but still share the same nav-tree-* id when docsets lack a project key in docset.yml
  • htmx hx-preserve then keeps the wrong sidebar DOM and expand/collapse state when moving between those pages

Notes

  • The content hash is 16 lowercase hex characters and only covers the preserved tree, not the dropdown or search
  • Codex and assembler builds both use the same render and cache path

Made with Cursor

Different sidebars could share the same nav-tree id when docsets lacked a project key, breaking htmx preserve. Map navigation to a render model, hash the tree once per root, and cache renders by root identity.

Co-authored-by: Cursor <cursoragent@cursor.com>
@reakaleek
reakaleek requested a review from a team as a code owner July 31, 2026 09:22
@reakaleek reakaleek added the bug label Jul 31, 2026
@reakaleek
reakaleek requested a review from cotti July 31, 2026 09:22
@reakaleek reakaleek added the bug label Jul 31, 2026
Resolve _TocTree.cshtml conflict by keeping main's removal of sidebar navigation-search and dropping the unused ShowSearch render-model flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant