slug redirects

Automatically creates slug redirects when document slugs change.

Community 0 31/wk MIT v2.0.0

Installation

pnpm add payload-slug-redirects

About

This plugin for PayloadCMS tracks changes to document slugs and automatically generates corresponding redirects. When a slug is renamed, it records the change using an `afterChange` hook, allowing old URLs to redirect to the new document slug when accessed. The plugin supports chained renames, ensuring that multiple updates to a slug point to the most current URL. Users can configure the plugin to watch specific collections and localizations. It injects a slug field when necessary and handles multi-locale compatibility with ease. On the frontend, the plugin provides a `SlugRedirect` component for Next.js apps to manage client-side redirects efficiently, querying the `slug-redirects` collection to ensure visitors are directed to the correct content even after slugs have changed. Additional options include revalidation endpoints for static site generation and configuring visibility settings for the management interface within Payload CMS. The plugin simplifies the handling of slug changes, making it a valuable tool for content-heavy applications.

Package info

Package name
payload-slug-redirects
Latest version
2.0.0
Unpacked size
55 kB
License
MIT
Weekly downloads
31
Last publish
Mar 20, 2026

Similar plugins

More in SEO