delmaredigital

payload page tree

by delmaredigital
Redirects & URLs
v3
>=3.0.0
MIT

Overview

Summary generated from the README

Extends Payload's built-in folders so folders define URL structure and slugs are generated from the folder path plus a page segment. The plugin adds folder, pageSegment, sortOrder and slugHistory fields to collections such as pages and posts, and registers a tree view in the admin. Collections need a plain text slug field, and Payload 3 or later is required.

Features

  • Auto-generates hierarchical slugs from folder path and page segment
  • Visual tree management view at the admin page-tree route
  • Adds folder, pageSegment, sortOrder and slugHistory fields automatically
  • Auto-detects pages and posts collections when no config is given
  • Configurable access function gating the tree endpoints, with collection access rules enforced
  • Makes the slug field read-only and managed by plugin hooks

Use cases

  • Build nested page URLs that mirror a folder structure in the CMS
  • Let editors reorganize site hierarchy visually and keep slugs consistent
  • Serve pages through a catch-all Next.js route using the full slug

From the author

Payload CMS plugin for folder-based hierarchical URL slugs with visual tree management

Installation

npm i @delmaredigital/payload-page-tree

19

Stars

2

Forks

0

Open Issues

3 weeks ago

Last Updated

536

Weekly Downloads

v0.4.1

npm Version

328.8 KB

Unpacked Size

2

Dependencies

GitHub stars

190 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 202619
Dec 5, 202619
Dec 4, 202619
Dec 3, 202619
Dec 2, 202619
Dec 1, 202619
Nov 30, 202619
Nov 29, 202619
Nov 28, 202619
Nov 27, 202619
Nov 26, 202619
Nov 25, 202619
Nov 24, 202619
Nov 23, 202619
Nov 22, 202619
Nov 21, 202619
Nov 20, 202619
Nov 19, 202619
Nov 18, 202619
Nov 17, 202619
Nov 16, 202619
Nov 15, 202619
Nov 14, 202619
Nov 13, 202619
Nov 12, 202619
Nov 11, 202619
Nov 10, 202619
Nov 9, 202619
Nov 8, 202619
Nov 7, 202619
Nov 6, 202619
Nov 5, 202619
Nov 4, 202619
Nov 3, 202619
Nov 2, 202619
Nov 1, 202619
Oct 31, 202619
Oct 30, 202619
Oct 29, 202619
Oct 28, 202619
Oct 27, 202619
Oct 26, 202619
Oct 25, 202619
Oct 24, 202619
Oct 23, 202619
Oct 22, 202619
Oct 21, 202619
Oct 20, 202619
Oct 19, 202619
Oct 18, 202619
Oct 17, 202619
Oct 16, 202619
Oct 15, 202619
Oct 14, 202619
Oct 13, 202619
Oct 12, 202619
Oct 11, 202619
Oct 10, 202619
Oct 9, 202619
Oct 8, 202619
Oct 7, 202619
Oct 6, 202619
Oct 5, 202619
Oct 4, 202619
Oct 3, 202619
Oct 2, 202619
Oct 1, 202619
Sep 30, 202619
Sep 29, 202619
Sep 28, 202619
Sep 27, 202619
Sep 26, 202619
Sep 25, 202619
Sep 24, 202619
Sep 23, 202619
Sep 22, 202619
Sep 21, 202619
Sep 20, 202619
Sep 19, 202619
Sep 18, 202619
Sep 17, 202619
Sep 16, 202619
Sep 15, 202619
Sep 14, 202619
Sep 13, 202619
Sep 12, 202619
Sep 11, 202619
Sep 10, 202619
Sep 9, 202619
Sep 8, 202619
Sep 7, 202619
npm weekly downloads

429−140 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026429
Dec 5, 2026393
Dec 4, 2026350
Dec 3, 2026337
Dec 2, 2026259
Dec 1, 2026214
Nov 30, 2026239
Nov 29, 2026298
Nov 28, 2026315
Nov 27, 2026350
Nov 26, 2026441
Nov 25, 2026475
Nov 24, 2026515
Nov 23, 2026521
Nov 22, 2026535
Nov 21, 2026531
Nov 20, 2026592
Nov 19, 2026539
Nov 18, 2026792
Nov 17, 2026797
Nov 16, 2026971
Nov 15, 2026910
Nov 14, 2026937
Nov 13, 2026867
Nov 12, 2026899
Nov 11, 2026577
Nov 10, 2026550
Nov 9, 2026354
Nov 8, 2026377
Nov 7, 2026408
Nov 6, 2026443
Nov 5, 2026473
Nov 4, 2026562
Nov 3, 2026609
Nov 2, 2026672
Nov 1, 2026692
Oct 31, 2026642
Oct 30, 2026574
Oct 29, 2026435
Oct 28, 2026310
Oct 27, 2026378
Oct 26, 2026423
Oct 25, 2026375
Oct 24, 2026504
Oct 23, 2026482
Oct 22, 2026540
Oct 21, 2026645
Oct 20, 2026531
Oct 19, 2026446
Oct 18, 2026447
Oct 17, 2026378
Oct 16, 2026446
Oct 15, 2026476
Oct 14, 2026457
Oct 13, 2026458
Oct 12, 2026459
Oct 11, 2026464
Oct 10, 2026439
Oct 9, 2026408
Oct 8, 2026371
Oct 7, 2026317
Oct 6, 2026296
Oct 5, 2026280
Oct 4, 2026299
Oct 3, 2026325
Oct 2, 2026365
Oct 1, 2026399
Sep 30, 2026632
Sep 29, 2026636
Sep 28, 2026656
Sep 27, 2026638
Sep 26, 2026573
Sep 25, 2026563
Sep 24, 2026529
Sep 23, 2026345
Sep 22, 2026349
Sep 21, 2026360
Sep 20, 2026463
Sep 19, 2026524
Sep 18, 2026753
Sep 17, 2026777
Sep 16, 2026732
Sep 15, 2026728
Sep 14, 2026688
Sep 13, 2026635
Sep 12, 2026621
Sep 11, 2026455
Sep 10, 2026564
Sep 9, 2026564
Sep 8, 2026557
Sep 7, 2026569

Each point is npm's rolling 7-day download count.

Health Score

81/100Excellent

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1131676452-root.svg)](https://payloaddirectory.dev/plugins/1131676452-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1131676452-root"><img src="https://payloaddirectory.dev/badge/1131676452-root.svg" alt="Payload Directory"></a>
Updated Nov 9, 2026Created Jan 10, 2026Published Nov 9, 2026

README

@delmaredigital/payload-page-tree

A Payload CMS plugin that extends the built-in folders feature to auto-generate hierarchical URL slugs. Folders define URL structure, pages pick a folder, and slugs are auto-generated.

Starter Template - Use This

Deploy with Vercel

Ask DeepWiki

Documentation: plugins.delmaredigital.com/docs/page-tree · Overview

Installation

pnpm add @delmaredigital/payload-page-tree

Quick Start

1. Add the plugin

// src/payload.config.ts
import { buildConfig } from 'payload'
import { pageTreePlugin } from '@delmaredigital/payload-page-tree'
import { Pages } from './collections/Pages'

export default buildConfig({
  collections: [Pages],
  plugins: [
    pageTreePlugin(),  // Auto-detects 'pages' and 'posts' if they exist
  ],
})

2. Define your collection

Your collections must have a slug field. The plugin makes it read-only and auto-generates values from folder path + page segment.

// src/collections/Pages/index.ts
import type { CollectionConfig } from 'payload'

export const Pages: CollectionConfig = {
  slug: 'pages',
  fields: [
    { name: 'title', type: 'text', required: true },
    {
      name: 'slug',
      type: 'text',
      required: true,
      unique: true,
      index: true,
    },
  ],
}

Important: Do NOT use Payload's slugField() helper. Use a plain text field — the plugin manages slugs via its own hooks.

3. Frontend routing

// app/[...slug]/page.tsx
export default async function Page({ params }: { params: { slug: string[] } }) {
  const fullSlug = params.slug.join('/')

  const { docs } = await payload.find({
    collection: 'pages',
    where: { slug: { equals: fullSlug } },
    limit: 1,
  })

  // ...
}

That's it! The plugin adds folder, pageSegment, sortOrder, and slugHistory fields automatically, and registers the tree view at /admin/page-tree.


Access control

The tree view calls fourteen endpoints under /api/page-tree/*. Two layers decide who may use them:

  1. Endpoint gate — the access option runs before every endpoint. By default it requires an authenticated Payload user (401 without a user, 403 when denied).
  2. Collection access rules — reads and writes on the documents a user operates on run with overrideAccess: false as the requesting user, so the access rules on your page and folder collections are enforced. URL maintenance (slug ancestry, collision checks, cascade inventories) reads with trusted access, but only beneath folders the user can read. See access control for the details.
pageTreePlugin({
  // Only admins may use the tree endpoints
  access: ({ req }) => req.user?.role === 'admin',
})

Upgrading from 0.3.16 or earlier: those versions registered the endpoints with no authentication and bypassed collection access rules. Upgrade, and review the access rules on your page and folder collections — they now govern the tree. See the CHANGELOG.

License

MIT

Similar plugins