Foundation + Schemas

This commit is contained in:
2026-09-21 16:59:08 +02:00
parent 3a27b60be4
commit f82d631ba6
25 changed files with 391 additions and 78 deletions

View File

@@ -0,0 +1,42 @@
import { fields } from '@keystatic/core'
import { ARTICLES } from '@/lib/constants/collections'
import { OPTIONAL_SEGMENT, SEGMENT_MESSAGE } from '@/lib/content/slug'
const segment = fields.text({
label: 'URL segment',
description: 'Optional- Leave empty to use the slugified title',
validation: {
pattern: {
regex: OPTIONAL_SEGMENT,
message: SEGMENT_MESSAGE,
},
},
})
export const pageRoute = fields.object(
{
segment,
},
{
label: 'Route',
},
)
export const articleRoute = fields.object(
{
segment,
parent: fields.relationship({
label: 'Parent',
description: 'Empty makes this a root',
collection: ARTICLES,
}),
index: fields.integer({
label: 'Index',
description: 'Sorts among siblings. Empty sorts by date, newest first',
}),
},
{
label: 'Route',
},
)