sittari-studio

slug field

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

Overview

Summary generated from the README

Provides a createSlugField function that returns a ready-made slug field row for Payload collections. By default the field is required, localized, derives from the title field and appears in the sidebar. Options let you set the source field, localization, instruction text per locale, and an overrides callback to modify or replace the result. Targets Payload 4.

Features

  • Factory function that returns a slug field for any collection
  • Defaults to required, localized, sourced from the title field and shown in the sidebar
  • Choose a different source field through the useAsSlug option
  • Optional per-locale instruction text shown in the admin
  • Overrides callback to modify or replace the finished field

Use cases

  • Add a consistent URL slug field to posts and pages collections
  • Generate slugs from a name field instead of title in non-localized collections
  • Show editors translated guidance on how the slug forms the page URL

From the author

Configurable slug field factory for Payload CMS.

Installation

npm i @sittari/payload-slug-field

0

Stars

0

Forks

0

Open Issues

1 months ago

Last Updated

0

Weekly Downloads

v0.4.1

npm Version

18.7 KB

Unpacked Size

2

Dependencies

Repository stars

Trends appear after 7 days of data. Daily snapshots have not started yet.

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

npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

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

Health Score

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

README

@sittari/payload-slug-field

A reusable, configurable Payload slug-field factory.

Install

pnpm add @sittari/payload-slug-field

Usage

import { createSlugField } from '@sittari/payload-slug-field';

export const Posts = {
  slug: 'posts',
  fields: [
    { name: 'title', type: 'text', required: true },
    createSlugField({
      instruction: {
        en: 'The slug becomes part of the page URL.',
        uk: 'Слаг стає частиною URL сторінки.',
      },
    }),
  ],
};

createSlugField() returns Payload's slug row. It is required, localized, uses title as its source, and appears in the sidebar by default. It adds no instruction text unless instruction is provided.

Use overrides to modify or replace the completed row:

createSlugField({
  useAsSlug: 'name',
  localized: false,
  overrides: (defaultSlugField) => ({
    ...defaultSlugField,
    admin: { ...defaultSlugField.admin, position: 'sidebar' },
  }),
});

Similar plugins