PR title: Fix deep page nesting in sidebar, prev/next order, and parent dropdown indent#330
PR title: Fix deep page nesting in sidebar, prev/next order, and parent dropdown indent#330
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves navigation support for documentation trees deeper than two levels by making the sidebar render a fully recursive hierarchy, updating prev/next navigation to respect full depth, and adding depth-based indentation for the “parent page” select.
Changes:
- Render sidebar sections recursively (Twig + CSS) and update the frontend sidebar JS to handle nested expand/collapse height calculations.
- Update sidebar filtering to operate on nested sections (not flat list items) and expand ancestor paths on matches.
- Remove depth caps in backend menu/flat navigation building so ordering works beyond level 2; add depth-indented parent
<select>options.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/styles/components/sidebar.pcss | Adjusts sidebar layout/styling to support nested sections and avoid overflow clipping. |
| src/frontend/js/modules/sidebar.js | Updates sidebar initialization and list max-height recalculation for deep nesting. |
| src/frontend/js/classes/sidebar-filter.js | Refactors filtering to recurse nested sections and expand ancestor sections. |
| src/backend/views/pages/form.twig | Switches parent <select> to use precomputed indentation options. |
| src/backend/views/components/sidebar.twig | Replaces inline markup with a recursive section include. |
| src/backend/views/components/sidebar-section.twig | New recursive Twig partial to render nested sidebar sections. |
| src/backend/utils/menu.ts | Removes hard-coded depth limit (2) and builds deeper menu trees by default. |
| src/backend/routes/pages.ts | Uses new parent select options provider for create/edit forms. |
| src/backend/routes/middlewares/pages.ts | Builds full-depth menu tree for templates. |
| src/backend/routes/index.ts | Ensures aliases routes also get menu via pages middleware. |
| src/backend/models/pagesFlatArray.ts | Uses full-depth flat array for prev/next navigation. |
| src/backend/controllers/pages.ts | Adds parent select option builder with depth/indent computation. |
| src/backend/build-static.ts | Builds static pages with full-depth menu tree. |
| package.json | Bumps package version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…roving efficiency and readability. Update sidebar filter to handle navigation more robustly by ensuring the correct element is clicked.
src/backend/controllers/pages.ts
Outdated
| const { pages, pagesMap } = excludePageId | ||
| ? await this.groupByParentWithMap(excludePageId) | ||
| : await this.groupByParentWithMap('' as EntityId); | ||
| const indentUnit = '\u00a0\u00a0'; |
There was a problem hiding this comment.
Seem like it is a presentation-specific logic, and should not be stored in a data model. depth is enough. You can add indents in a template then.
src/backend/views/pages/form.twig
Outdated
| | ||
| {% endif %} | ||
| {{ _page.title }} | ||
| {{- entry.indent -}}{{- _page.title -}} |
There was a problem hiding this comment.
please, add "strip tags" filter to the title to prevent xss
…ine data structure. Update Twig template to handle depth-based indentation for improved clarity in dropdowns.
Summary
Improves support for documentation trees deeper than two levels: the sidebar now builds and renders the full hierarchy, flat navigation respects all depths, and the “parent page” select shows depth via indentation.