Skip to content

PR title: Fix deep page nesting in sidebar, prev/next order, and parent dropdown indent#330

Merged
Dobrunia merged 5 commits intomainfrom
feat/deep-page-nesting
Apr 4, 2026
Merged

PR title: Fix deep page nesting in sidebar, prev/next order, and parent dropdown indent#330
Dobrunia merged 5 commits intomainfrom
feat/deep-page-nesting

Conversation

@Dobrunia
Copy link
Copy Markdown
Member

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.

@Dobrunia Dobrunia marked this pull request as ready for review March 30, 2026 18:12
@neSpecc neSpecc requested a review from Copilot March 30, 2026 23:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
const { pages, pagesMap } = excludePageId
? await this.groupByParentWithMap(excludePageId)
: await this.groupByParentWithMap('' as EntityId);
const indentUnit = '\u00a0\u00a0';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

&nbsp;
{% endif %}
{{ _page.title }}
{{- entry.indent -}}{{- _page.title -}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@Dobrunia Dobrunia requested a review from neSpecc April 3, 2026 12:46
@Dobrunia Dobrunia merged commit 42bf11c into main Apr 4, 2026
1 check passed
@Dobrunia Dobrunia deleted the feat/deep-page-nesting branch April 4, 2026 11:01
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.

4 participants