Nested pages, with paths and breadcrumbs
About → Team → Engineering. The new plugin keeps every path and breadcrumb up to date when a page moves, in every language.
Most sites have pages inside pages: About, then Team under it. Easy CMS 0.21 adds @easy-cms/plugin-nested-docs for that.
import { nestedDocsPlugin } from '@easy-cms/plugin-nested-docs'
plugins: [nestedDocsPlugin({ collections: ['pages'] })]What each page gets
A
parentfield to pick the page above it.Its full
path, such as/about/team, per language when the slug is localized.Its
breadcrumbs, ready for navigation and for BreadcrumbList structured data.
When a page moves
Give a page a new slug or a new parent and the pages under it get new paths too, when it is published. With the redirects plugin, their old addresses redirect to the new ones. A page can't be moved under itself, maxDepth limits how deep the tree goes, and a page with pages under it can't be deleted unless you choose onDeleteParent: 'orphan'.
Reading the tree
findByPath() finds the page for an address, getTree() builds menus, and GET /api/cms/tree/:collection gives the same to other frontends. For pages that existed before the plugin, npx easy-cms nested:rebuild works out their paths. The plugin adds fields, so create a migration after installing it.
Also in 0.21
Relationship
filterOptions: which documents a relationship may point to, checked on the server; the admin's picker offers only those.Slug
uniqueWithin: slugs unique only among documents with the same value of another field, such as the same parent.