last commit before switching to nextjs
All checks were successful
Build and Deploy Astro Site / deploy (push) Successful in 24s
All checks were successful
Build and Deploy Astro Site / deploy (push) Successful in 24s
This commit is contained in:
64
src/definitions/fields/publishing.ts
Normal file
64
src/definitions/fields/publishing.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { fields } from '@keystatic/core'
|
||||
import { z } from 'zod'
|
||||
|
||||
export const publishingField = fields.object(
|
||||
{
|
||||
publishDate: fields.date({ label: 'Publish Date' }),
|
||||
editDate: fields.date({ label: 'Edit Date' }),
|
||||
status: fields.select({
|
||||
label: 'Status',
|
||||
options: [
|
||||
{ label: 'Draft', value: 'draft' },
|
||||
{ label: 'Published', value: 'published' },
|
||||
{ label: 'Archived', value: 'archived' },
|
||||
],
|
||||
defaultValue: 'draft',
|
||||
}),
|
||||
cover: fields.object(
|
||||
{
|
||||
src: fields.image({ label: 'Image' }),
|
||||
alt: fields.text({ label: 'Alt' }),
|
||||
},
|
||||
{
|
||||
label: 'Cover',
|
||||
}
|
||||
),
|
||||
featured: fields.checkbox({
|
||||
label: 'Featured',
|
||||
description: 'Show on Homepage',
|
||||
}),
|
||||
tags: fields.array(
|
||||
fields.relationship({
|
||||
label: 'Tags',
|
||||
collection: 'tags',
|
||||
}),
|
||||
{
|
||||
label: 'Tags',
|
||||
itemLabel: (props) => props.value || 'Select Tag',
|
||||
}
|
||||
),
|
||||
author: fields.relationship({
|
||||
label: 'Author',
|
||||
collection: 'authors',
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Publishing',
|
||||
layout: [4, 4, 4, 12, 12, 12, 12],
|
||||
}
|
||||
)
|
||||
|
||||
export const publishingFieldSchema = z.object({
|
||||
publishDate: z.date().optional(),
|
||||
editDate: z.date().optional(),
|
||||
status: z.enum(['draft', 'published', 'archived']),
|
||||
cover: z
|
||||
.object({
|
||||
src: z.string(),
|
||||
alt: z.string(),
|
||||
})
|
||||
.optional(),
|
||||
featured: z.boolean().default(false),
|
||||
tags: z.array(z.string()).optional(),
|
||||
author: z.string().optional(),
|
||||
})
|
||||
Reference in New Issue
Block a user