sittari-studio

permalink

by sittari-studio
payload-plugins
Redirects & URLs
v4
^4.0.0-0
MIT

Overview

Summary generated from the README

Manages slugs, canonical paths and a published route registry for chosen collections. Each collection gets a prefix and optional parent field for nested paths, and a WordPress-style permalink editor replaces the raw slug and path fields. Includes server-side helpers to find a document by path. Targets Payload 4 prerelease versions.

Features

  • Per-collection path prefixes, like WordPress custom post type rewrite prefixes
  • Route registry enforces unique published paths and suffixes the slug with the document ID on conflict
  • Reserved home slug maps to the root of a collection prefix
  • Locale prefix modes: as-needed or always
  • Hierarchical paths built from a parent field, for example with the nested docs plugin
  • Path lookup helper with automatic page-number pagination paths

Use cases

  • Build WordPress-style URLs such as blog posts under a prefix with editable slugs
  • Resolve incoming request paths to documents in a Next.js frontend
  • Serve localized sites with per-locale paths and optional locale prefixes

From the author

WordPress-style slugs, canonical paths, permalinks, and routing helpers for Payload CMS.

Installation

npm i @sittari/payload-permalink

0

Stars

0

Forks

0

Open Issues

2 months ago

Last Updated

23

Weekly Downloads

v1.1.1

npm Version

137.6 KB

Unpacked Size

1

Dependencies

Repository stars

00 since Sep 7

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

Shared by 8 plugins in sittari-studio/payload-plugins.

npm weekly downloads

23−206 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202623
Dec 5, 202612
Dec 4, 202613
Dec 3, 202613
Dec 2, 202611
Dec 1, 202611
Nov 30, 202611
Nov 29, 20269
Nov 28, 20268
Nov 27, 20269
Nov 26, 20269
Nov 25, 20264
Nov 24, 20264
Nov 23, 20264
Nov 22, 20266
Nov 21, 20266
Nov 20, 202613
Nov 19, 202614
Nov 18, 202621
Nov 17, 202620
Nov 16, 202622
Nov 15, 202621
Nov 14, 202622
Nov 13, 202613
Nov 12, 202613
Nov 11, 20265
Nov 10, 202611
Nov 9, 202615
Nov 8, 202614
Nov 7, 202617
Nov 6, 202617
Nov 5, 202622
Nov 4, 202623
Nov 3, 202617
Nov 2, 202611
Nov 1, 202611
Oct 31, 20267
Oct 30, 20267
Oct 29, 20261
Oct 28, 20260
Oct 27, 20262
Oct 26, 20264
Oct 25, 20267
Oct 24, 202614
Oct 23, 202614
Oct 22, 202616
Oct 21, 202622
Oct 20, 202622
Oct 19, 202620
Oct 18, 202618
Oct 17, 202615
Oct 16, 202616
Oct 15, 202620
Oct 14, 202614
Oct 13, 202614
Oct 12, 202615
Oct 11, 202615
Oct 10, 202621
Oct 9, 202629
Oct 8, 202626
Oct 7, 202629
Oct 6, 202639
Oct 5, 202640
Oct 4, 202645
Oct 3, 202644
Oct 2, 202636
Oct 1, 202634
Sep 30, 202640
Sep 29, 202629
Sep 28, 202643
Sep 27, 202638
Sep 26, 202642
Sep 25, 202650
Sep 24, 202652
Sep 23, 202653
Sep 22, 202662
Sep 21, 202681
Sep 20, 2026360
Sep 19, 2026350
Sep 18, 2026342
Sep 17, 2026347
Sep 16, 2026341
Sep 15, 2026340
Sep 14, 2026309
Sep 13, 202633
Sep 12, 202638
Sep 11, 202643
Sep 10, 202639
Sep 9, 202666
Sep 8, 2026220
Sep 7, 2026229

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

Health Score

62/100Good

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/1294311885-permalink.svg)](https://payloaddirectory.dev/plugins/1294311885-permalink)
HTML
<a href="https://payloaddirectory.dev/plugins/1294311885-permalink"><img src="https://payloaddirectory.dev/badge/1294311885-permalink.svg" alt="Payload Directory"></a>
Updated Sep 11, 2026Created Jul 8, 2026Published Sep 11, 2026

README

A WordPress-style permalink system for Payload CMS. The plugin owns the slug, canonical path, published route registry, permalink editor, lookup, pagination, and path rebuilding for selected collections.

import { permalinkPlugin } from '@sittari/payload-permalink';

permalinkPlugin({
  siteUrl: 'https://example.com',
  localePrefix: 'as-needed',
  collections: {
    pages: { prefix: '' },
    posts: { prefix: 'blog' },
    categories: {
      prefix: 'category',
      parentField: 'parent',
    },
  },
});

A collection prefix works like a WordPress custom post type rewrite prefix:

  • pages + slug about -> /about
  • posts + slug hello-world -> /blog/hello-world
  • nested category shoes / boots -> /category/shoes/boots

Use the reserved slug __home for the root of a collection prefix:

  • pages + __home -> /
  • Ukrainian pages + __home -> /uk
  • posts + __home -> /blog

__home is preserved by slug normalization and omitted only when composing the canonical path. The constant is exported as HOME_SLUG.

The plugin uses the collection's admin.useAsTitle field as the slug source, falling back to title. If a collection already has a text slug field, it is reused; otherwise the plugin adds a plain localized text field. Slugs are not unique on their own: they are normalized URL segments, while final published path uniqueness is enforced by the route registry. If a published path is already claimed, the new document's slug is suffixed once with -{documentID} and its path is recomputed. Drafts and autosaves are left unchanged because they do not reserve routes. If the suffixed path is also occupied, normal permalink validation fails.

The raw slug and path fields are hidden and replaced by a WordPress-style permalink display which edits only the final slug segment.

The permalink editor exposes stable global classes and uses low-specificity default styles, so client app CSS can override them directly:

.sittari-permalink-field {
  /* container */
}

.sittari-permalink-field__label {
}
.sittari-permalink-field__prefix {
}
.sittari-permalink-field__link {
}
.sittari-permalink-field__placeholder {
}
.sittari-permalink-field__input {
}
.sittari-permalink-field__error {
}
.sittari-permalink-field__button {
}
.sittari-permalink-field__button--edit {
}
.sittari-permalink-field__button--ok {
}
.sittari-permalink-field__button--cancel {
}

State classes are applied to the root element as needed:

.sittari-permalink-field--editing {
}
.sittari-permalink-field--error {
}
.sittari-permalink-field--disabled {
}

Localization

localePrefix defaults to as-needed:

en: /about
uk: /uk/about

Use always to prefix every locale:

en: /en/about
uk: /uk/about

Hierarchical collections

When parentField is used, the plugin which creates that self-referencing relationship (for example @payloadcms/plugin-nested-docs) must run before permalinkPlugin. Child paths append their slug to the parent's canonical path.

Published routes

Drafts and autosaves do not reserve routes. Publishing claims the canonical path, changing a published permalink moves the claim, and unpublishing, trashing, or deleting releases it. Global path uniqueness is enforced by the internal route registry.

Lookup

Create bound helpers in server-only code:

import { createPathHelpers } from '@sittari/payload-permalink';
import { getPayload } from 'payload';
import config from '@payload-config';

export const paths = createPathHelpers({
  getPayload: () => getPayload({ config }),
});
const result = await paths.findDocumentByPath({
  path: '/blog/hello-world',
  overrideAccess: false,
});

Lookup resolves the internal route first and then loads the target document. Terminal /page/:page paths are interpreted automatically, with exact stored routes taking precedence over pagination fallback.

Similar plugins