Skip to main content

Module menus

Module menus 

Source
Expand description

GET /api/v2/menus/ + GET /api/v2/menus/{slug}/.

Exposes the navigation the admin builds so headless frontends can render the navbar. Reuses crate::navigation::resolve_menus_with — the same resolved tree the server-side Tera path produces (page links resolve to url_path, external items pass through, nesting preserved). Menu items target cms_page rows, so code-defined and UI-created pages appear alike.

Both endpoints are viewer-aware (#members) and both take ?locale=. detail additionally takes ?current=<page id> and marks the active item and its trail, so a client renders highlighting without re-deriving ancestry from URLs.

Structs§

MenuQuery
Query string shared by both endpoints.

Functions§

detail
GET /api/v2/menus/{slug}/ — the resolved nested tree for one menu. Viewer-aware (#members): items the caller can’t access are hidden.
detail_inner
Takes a &Pool for the same reason crate::api::tree::tree_inner does — so the resolved tree is testable without a PostgreSQL tenant.
list
GET /api/v2/menus/ — list configured menus (slug + name).
list_inner