Files
website/src/keystatic/fields/content/base.ts
2026-09-24 09:58:25 +02:00

46 lines
849 B
TypeScript

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 subtitle = fields.text({
label: 'Subtitle',
})
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,
subtitle,
status,
noindex,
}