Nested Docs

Adds parent-child document hierarchies with auto-generated breadcrumbs to Payload collections.

Official 43,434 70.7k/wk MIT v3.85.2

Installation

pnpm add @payloadcms/plugin-nested-docs

About

The Nested Docs plugin turns any Payload collection into a page tree. Pick the collection slugs you want to extend and the plugin attaches a `parent` relationship field (placed in the sidebar) and a `breadcrumbs` array field to each one. Editors pick a parent document, and the plugin walks the chain to build and store a breadcrumb trail on every doc. Breadcrumbs are populated in a `beforeChange` hook and written back to the document, so the hierarchy is queryable at read time rather than reconstructed on the fly. An `afterChange` hook resaves child documents when a parent moves, keeping descendant URLs and labels in sync. The parent field's `filterOptions` excludes the current doc and any of its ancestors, which prevents reference cycles. The breadcrumbs field is localized and read-only in the admin UI. Each entry stores a relationship to its document plus a generated `url` and `label`. Both are produced through optional `generateURL` and `generateLabel` functions that receive the full ancestor chain, the current doc, the collection config, and the request, so you control URL and label formatting per project. Configuration is minimal: pass the target `collections` array, and optionally override the `parentFieldSlug` and `breadcrumbsFieldSlug` if your collections already define fields with those names. The plugin can be registered more than once with different collection sets when you need separate trees. It targets Payload 4 (currently published as a beta) and exports a `getParents` helper for fetching the ancestor chain outside the admin context.

Package info

Package name
@payloadcms/plugin-nested-docs
Latest version
3.85.2
Unpacked size
51 kB
License
MIT
Weekly downloads
70.7k
Last publish
Jul 1, 2026

More from payloadcms

View profile

Similar plugins

More in Content