Files
payload/examples/custom-server/src/collections/Pages.ts
2023-06-28 16:35:41 -04:00

40 lines
665 B
TypeScript

import type { CollectionConfig } from 'payload/types'
import formatSlug from '../utilities/formatSlug'
export const Pages: CollectionConfig = {
slug: 'pages',
admin: {
useAsTitle: 'title',
},
access: {
read: () => true,
},
fields: [
{
name: 'title',
label: 'Title',
type: 'text',
required: true,
},
{
name: 'richText',
type: 'richText',
label: 'Content',
},
{
name: 'slug',
label: 'Slug',
type: 'text',
admin: {
position: 'sidebar',
},
hooks: {
beforeValidate: [formatSlug('title')],
},
},
],
}
export default Pages