Foundation + Schemas
This commit is contained in:
40
src/keystatic/fields/content/base.ts
Normal file
40
src/keystatic/fields/content/base.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { fields } from '@keystatic/core'
|
||||
|
||||
import { STATUS_OPTIONS } from '@/lib/constants/status'
|
||||
import { SEGMENT, SEGMENT_MESSAGE, slugify } from '@/lib/content/slug'
|
||||
|
||||
export const title = fields.slug({
|
||||
name: {
|
||||
label: 'Title',
|
||||
validation: {
|
||||
isRequired: true,
|
||||
},
|
||||
},
|
||||
slug: {
|
||||
label: 'File ID',
|
||||
description: 'Internal and unique across the collection.',
|
||||
generate: slugify,
|
||||
validation: {
|
||||
pattern: {
|
||||
regex: SEGMENT,
|
||||
message: SEGMENT_MESSAGE,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export const status = fields.select({
|
||||
label: 'Status',
|
||||
options: STATUS_OPTIONS,
|
||||
defaultValue: 'draft',
|
||||
})
|
||||
|
||||
export const noindex = fields.checkbox({
|
||||
label: 'Hide from search engines',
|
||||
})
|
||||
|
||||
export const base = {
|
||||
title,
|
||||
status,
|
||||
noindex,
|
||||
}
|
||||
Reference in New Issue
Block a user