Slug Field
Auto-generate URL-friendly slugs
Usage
import { slugField } from '@adsign/payload-adsign-plugin';
export const Articles: CollectionConfig = {
fields: [
{
name: 'title',
type: 'text',
},
slugField({
useAsSlug: 'title',
}),
],
};Options
| Option | Type | Default | Description |
|---|---|---|---|
useAsSlug | string | - | Field to generate slug from |
locale | string | 'en' | Locale for transliteration |
name | string | 'slug' | Field name |
required | boolean | true | Is required |
Examples
With custom locale:
slugField({
useAsSlug: 'title',
locale: 'nb', // Norwegian
})In sidebar:
slugField({
useAsSlug: 'title',
admin: { position: 'sidebar' },
})