Adds a computed localizedSlugs field to configured collections, collecting slug and fullPath values for each locale. It is configured per collection through the plugins array and works with localized slug fields, with optional slug generation from a title and custom diacritics mapping. It also ships client components for Next.js, including a provider and a hook for language switchers. Built for Payload v3.
Localized slugs plugin for Payload CMS v3 with multi-locale support
Installation
npm i @kilivi/payloadcms-localized-slugs9
Stars
1
Forks
0
Open Issues
3 weeks ago
Last Updated
83
Weekly Downloads
v1.1.9
npm Version
110.2 KB
Unpacked Size
0
Dependencies
90 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 9 |
| Dec 4, 2026 | 9 |
| Dec 3, 2026 | 9 |
| Dec 2, 2026 | 9 |
| Dec 1, 2026 | 9 |
| Nov 30, 2026 | 9 |
| Nov 29, 2026 | 9 |
| Nov 28, 2026 | 9 |
| Nov 27, 2026 | 9 |
| Nov 26, 2026 | 9 |
| Nov 25, 2026 | 9 |
| Nov 24, 2026 | 9 |
| Nov 23, 2026 | 9 |
| Nov 22, 2026 | 9 |
| Nov 21, 2026 | 9 |
| Nov 20, 2026 | 9 |
| Nov 19, 2026 | 9 |
| Nov 18, 2026 | 9 |
| Nov 17, 2026 | 9 |
| Nov 16, 2026 | 9 |
| Nov 15, 2026 | 9 |
| Nov 14, 2026 | 9 |
| Nov 13, 2026 | 9 |
| Nov 12, 2026 | 9 |
| Nov 11, 2026 | 9 |
| Nov 10, 2026 | 9 |
| Nov 9, 2026 | 9 |
| Nov 8, 2026 | 9 |
| Nov 7, 2026 | 9 |
| Nov 6, 2026 | 9 |
| Nov 5, 2026 | 9 |
| Nov 4, 2026 | 9 |
| Nov 3, 2026 | 9 |
| Nov 2, 2026 | 9 |
| Nov 1, 2026 | 9 |
| Oct 31, 2026 | 9 |
| Oct 30, 2026 | 9 |
| Oct 29, 2026 | 9 |
| Oct 28, 2026 | 9 |
| Oct 27, 2026 | 9 |
| Oct 26, 2026 | 9 |
| Oct 25, 2026 | 9 |
| Oct 24, 2026 | 9 |
| Oct 23, 2026 | 9 |
| Oct 22, 2026 | 9 |
| Oct 21, 2026 | 9 |
| Oct 20, 2026 | 9 |
| Oct 19, 2026 | 9 |
| Oct 18, 2026 | 9 |
| Oct 17, 2026 | 9 |
| Oct 16, 2026 | 9 |
| Oct 15, 2026 | 9 |
| Oct 14, 2026 | 9 |
| Oct 13, 2026 | 9 |
| Oct 12, 2026 | 9 |
| Oct 11, 2026 | 9 |
| Oct 10, 2026 | 9 |
| Oct 9, 2026 | 9 |
| Oct 8, 2026 | 9 |
| Oct 7, 2026 | 9 |
| Oct 6, 2026 | 9 |
| Oct 5, 2026 | 9 |
| Oct 4, 2026 | 9 |
| Oct 3, 2026 | 9 |
| Oct 2, 2026 | 9 |
| Oct 1, 2026 | 9 |
| Sep 30, 2026 | 9 |
| Sep 29, 2026 | 9 |
| Sep 28, 2026 | 9 |
| Sep 27, 2026 | 9 |
| Sep 26, 2026 | 9 |
| Sep 25, 2026 | 9 |
| Sep 24, 2026 | 9 |
| Sep 23, 2026 | 9 |
| Sep 22, 2026 | 9 |
| Sep 21, 2026 | 9 |
| Sep 20, 2026 | 9 |
| Sep 19, 2026 | 9 |
| Sep 18, 2026 | 9 |
| Sep 17, 2026 | 9 |
| Sep 16, 2026 | 9 |
| Sep 15, 2026 | 9 |
| Sep 14, 2026 | 9 |
| Sep 13, 2026 | 9 |
| Sep 12, 2026 | 9 |
| Sep 11, 2026 | 9 |
| Sep 10, 2026 | 9 |
| Sep 9, 2026 | 9 |
| Sep 8, 2026 | 9 |
| Sep 7, 2026 | 9 |
| Sep 6, 2026 | 9 |
Shared by 3 plugins in vitakili/payload-plugins.
76−4 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 76 |
| Dec 4, 2026 | 81 |
| Dec 3, 2026 | 141 |
| Dec 2, 2026 | 135 |
| Dec 1, 2026 | 84 |
| Nov 30, 2026 | 86 |
| Nov 29, 2026 | 96 |
| Nov 28, 2026 | 93 |
| Nov 27, 2026 | 102 |
| Nov 26, 2026 | 57 |
| Nov 25, 2026 | 72 |
| Nov 24, 2026 | 132 |
| Nov 23, 2026 | 323 |
| Nov 22, 2026 | 318 |
| Nov 21, 2026 | 332 |
| Nov 20, 2026 | 320 |
| Nov 19, 2026 | 306 |
| Nov 18, 2026 | 292 |
| Nov 17, 2026 | 228 |
| Nov 16, 2026 | 40 |
| Nov 15, 2026 | 33 |
| Nov 14, 2026 | 24 |
| Nov 13, 2026 | 21 |
| Nov 12, 2026 | 21 |
| Nov 11, 2026 | 72 |
| Nov 10, 2026 | 126 |
| Nov 9, 2026 | 122 |
| Nov 8, 2026 | 121 |
| Nov 7, 2026 | 124 |
| Nov 6, 2026 | 125 |
| Nov 5, 2026 | 128 |
| Nov 4, 2026 | 77 |
| Nov 3, 2026 | 33 |
| Nov 2, 2026 | 36 |
| Nov 1, 2026 | 38 |
| Oct 31, 2026 | 27 |
| Oct 30, 2026 | 25 |
| Oct 29, 2026 | 20 |
| Oct 28, 2026 | 18 |
| Oct 27, 2026 | 14 |
| Oct 26, 2026 | 13 |
| Oct 25, 2026 | 12 |
| Oct 24, 2026 | 14 |
| Oct 23, 2026 | 14 |
| Oct 22, 2026 | 17 |
| Oct 21, 2026 | 28 |
| Oct 20, 2026 | 25 |
| Oct 19, 2026 | 23 |
| Oct 18, 2026 | 23 |
| Oct 17, 2026 | 24 |
| Oct 16, 2026 | 25 |
| Oct 15, 2026 | 23 |
| Oct 14, 2026 | 66 |
| Oct 13, 2026 | 66 |
| Oct 12, 2026 | 65 |
| Oct 11, 2026 | 66 |
| Oct 10, 2026 | 61 |
| Oct 9, 2026 | 68 |
| Oct 8, 2026 | 68 |
| Oct 7, 2026 | 15 |
| Oct 6, 2026 | 17 |
| Oct 5, 2026 | 18 |
| Oct 4, 2026 | 20 |
| Oct 3, 2026 | 28 |
| Oct 2, 2026 | 29 |
| Oct 1, 2026 | 33 |
| Sep 30, 2026 | 36 |
| Sep 29, 2026 | 34 |
| Sep 28, 2026 | 42 |
| Sep 27, 2026 | 40 |
| Sep 26, 2026 | 40 |
| Sep 25, 2026 | 36 |
| Sep 24, 2026 | 41 |
| Sep 23, 2026 | 44 |
| Sep 22, 2026 | 49 |
| Sep 21, 2026 | 93 |
| Sep 20, 2026 | 98 |
| Sep 19, 2026 | 93 |
| Sep 18, 2026 | 102 |
| Sep 17, 2026 | 300 |
| Sep 16, 2026 | 299 |
| Sep 15, 2026 | 294 |
| Sep 14, 2026 | 242 |
| Sep 13, 2026 | 235 |
| Sep 12, 2026 | 246 |
| Sep 11, 2026 | 285 |
| Sep 10, 2026 | 79 |
| Sep 9, 2026 | 76 |
| Sep 8, 2026 | 77 |
| Sep 7, 2026 | 79 |
| Sep 6, 2026 | 80 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1070225561-localized-slugs)<a href="https://payloaddirectory.dev/plugins/1070225561-localized-slugs"><img src="https://payloaddirectory.dev/badge/1070225561-localized-slugs.svg" alt="Payload Directory"></a>README
Localized slugs plugin for Payload CMS v3 with multi-locale support. Automatically copies and manages URL-friendly slugs for collections with internationalization (i18n) capabilities.
localizedSlugsnpm install @kilivi/payloadcms-localized-slugs
# or
pnpm add @kilivi/payloadcms-localized-slugs
# or
yarn add @kilivi/payloadcms-localized-slugs
import { localizedSlugsPlugin } from '@kilivi/payloadcms-localized-slugs'
export default buildConfig({
plugins: [
localizedSlugsPlugin({
enabled: true,
locales: ['cs', 'en'],
collections: [
{
collection: 'pages',
slugField: 'slug',
fullPathField: 'fullPath',
},
],
enableLogging: true, // Show debug logs
}),
],
})
The plugin automatically:
localized: true and regular fieldsslug and fullPath values and copies them to localizedSlugsInput Collection:
{
name: 'slug',
type: 'text',
localized: true, // Must be localized!
}
{
name: 'fullPath',
type: 'text',
localized: true, // Must be localized!
}
Output Document:
{
"slug": {
"en": "contact-us",
"cs": "kontaktujte-nas"
},
"fullPath": {
"en": "/contact-us",
"cs": "/kontaktujte-nas"
},
"localizedSlugs": {
"en": {
"slug": "contact-us",
"fullPath": "/contact-us"
},
"cs": {
"slug": "kontaktujte-nas",
"fullPath": "/kontaktujte-nas"
}
}
}
{
collection: 'pages',
slugField: 'urlSlug',
generateFromTitle: true,
titleField: 'pageTitle',
},
],
enableLogging: true,
}),
], })
## Configuration
### Plugin Options
```typescript
interface LocalizedSlugsPluginOptions {
/** Whether the plugin is enabled (default: true) */
enabled?: boolean
/** Array of supported locales (default: ['cs', 'en']) */
locales?: ('cs' | 'en')[]
/** Default locale (default: 'cs') */
defaultLocale?: 'cs' | 'en'
/** Collections configuration */
collections?: CollectionConfig[]
/** Enable console logging (default: false) */
enableLogging?: boolean
/** Custom diacritics mapping for slug generation */
customDiacriticsMap?: Record<string, string>
}
interface CollectionConfig {
/** Collection slug */
collection: string
/** Field name for the slug (default: 'slug') */
slugField?: string
/** Field name for the full path (default: 'fullPath') */
fullPathField?: string
/** Auto-generate slugs from title field (default: false) */
generateFromTitle?: boolean
/** Title field name for auto-generation (default: 'title') */
titleField?: string
}
The plugin automatically generates URL-friendly slugs from titles:
Example:
"Čeština" → "cestina"
"Hello World" → "hello-world"
"C++ Programming" → "c-programming"
Each locale gets its own slug based on the localized title:
// In your collection:
{
title: {
cs: "Přispívání",
en: "Contributing"
},
slug: {
cs: "prispivani", // Auto-generated
en: "contributing" // Auto-generated
}
}
For hierarchical collections (e.g., pages with parents), the plugin generates full paths:
// Parent: /docs
// Child with slug "guides" → /docs/guides
{
slug: "guides",
fullPath: "/docs/guides" // Auto-generated
}
To add custom locales beyond Czech and English:
import { localizedSlugsPlugin } from '@kilivi/payloadcms-localized-slugs'
localizedSlugsPlugin({
locales: ['cs', 'en', 'sk'], // Add Slovak
defaultLocale: 'cs',
customDiacriticsMap: {
š: 's',
ž: 'z',
ť: 't',
ľ: 'l',
},
// ... rest of config
})
Override the default diacritics mapping:
localizedSlugsPlugin({
customDiacriticsMap: {
á: 'a',
é: 'e',
í: 'i',
ó: 'o',
ú: 'u',
ü: 'u',
},
})
export const Posts: CollectionConfig = {
slug: 'posts',
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
},
{
name: 'slug',
type: 'text',
localized: true,
admin: {
description: 'Auto-generated from title. Edit to customize.',
},
},
{
name: 'content',
type: 'richText',
localized: true,
},
],
}
export const Pages: CollectionConfig = {
slug: 'pages',
fields: [
{
name: 'parent',
type: 'relationship',
relationTo: 'pages',
required: false,
},
{
name: 'title',
type: 'text',
localized: true,
required: true,
},
{
name: 'slug',
type: 'text',
localized: true,
},
{
name: 'fullPath',
type: 'text',
localized: true,
admin: {
readOnly: true,
description: 'Full URL path (auto-generated)',
},
},
],
}
createLocalizedSlugFieldCreates a localized slug field configuration:
import { createLocalizedSlugField } from '@kilivi/payloadcms-localized-slugs/fields'
const slugField = createLocalizedSlugField({
locales: ['cs', 'en'],
defaultLocale: 'cs',
})
createPopulateLocalizedSlugsHookCreates a hook for automatic slug generation:
import { createPopulateLocalizedSlugsHook } from '@kilivi/payloadcms-localized-slugs/hooks'
const beforeChangeHook = createPopulateLocalizedSlugsHook({
slugField: 'slug',
titleField: 'title',
locales: ['cs', 'en'],
})
import { localizedSlugsPlugin } from '@kilivi/payloadcms-localized-slugs'
export default buildConfig({
collections: [
{
slug: 'posts',
fields: [
{ name: 'title', type: 'text', localized: true },
{ name: 'slug', type: 'text', localized: true },
{ name: 'content', type: 'richText', localized: true },
],
},
],
plugins: [
localizedSlugsPlugin({
locales: ['cs', 'en'],
collections: [
{
collection: 'posts',
generateFromTitle: true,
},
],
}),
],
})
localizedSlugsPlugin({
locales: ['cs', 'en'],
collections: [
{
collection: 'docs',
slugField: 'slug',
fullPathField: 'urlPath',
generateFromTitle: true,
titleField: 'title',
},
],
})
generateFromTitle: true in collection configtitleField matches your field namelocalized: truecustomDiacriticsMap for unsupported charactersfullPathField matches your field nameThe plugin provides client components for use in your Next.js frontend application.
// app/layout.tsx
'use client'
import { SlugProvider } from '@kilivi/payloadcms-localized-slugs/client'
export default function RootLayout({ children }) {
return (
<html>
<body>
<SlugProvider>
{children}
</SlugProvider>
</body>
</html>
)
}
// app/[locale]/posts/[slug]/page.tsx
import { ClientSlugHandler } from '@kilivi/payloadcms-localized-slugs/client'
export default async function PostPage({ params }) {
const post = await getPayloadData('posts', params.slug)
return (
<div>
<ClientSlugHandler localizedSlugs={post.localizedSlugs} />
<h1>{post.title}</h1>
</div>
)
}
'use client'
import { useSlugContext } from '@kilivi/payloadcms-localized-slugs/client'
import Link from 'next/link'
export function LanguageSwitcher() {
const { state } = useSlugContext()
const { localizedSlugs } = state
return (
<nav>
{Object.entries(localizedSlugs).map(([locale, slug]) => (
<Link key={locale} href={`/${locale}/${slug}`}>
{locale.toUpperCase()}
</Link>
))}
</nav>
)
}
📖 For detailed client component usage, see the Client Components Usage Guide
MIT
Kilián Vít
Contributions welcome! Please open an issue or submit a PR.
See CHANGELOG.md for version history.
paths
Stored, queryable document paths for Payload page trees with publish-time uniqueness and a framework-agnostic resolver
60164/wk16v3
redirects
Manage internal and external redirects from the Payload admin panel
100200.1k/wk46.1kv3 v4
nested docs
Official plugin for nesting Payload documents inside one another
100151.9k/wk46.1kv3 v4
payload page tree
Folder-based hierarchical URL slugs with a visual page tree in the Payload admin
81536/wk19v3
payload slug
Slug field with Auto/Manual modes, nested source paths, localization and enforced uniqueness
802.4k/wk0v3
path
Stored, indexed URL paths for Payload 4 pages and posts built from a parent and a slug
75270/wk10v4