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,30 @@
import { collection, fields } from '@keystatic/core'
import { base } from '@/keystatic/fields/content/base'
import { content } from '@/keystatic/fields/content/content'
import { dates } from '@/keystatic/fields/content/dates'
import { articleRoute } from '@/keystatic/fields/content/route'
import { articleSummary } from '@/keystatic/fields/content/summary'
import { ARTICLES, TAGS } from '@/lib/constants/collections'
export const articles = collection({
label: 'Articles',
slugField: 'title',
path: `src/content/general/${ARTICLES}/*`,
format: {
contentField: 'content',
},
entryLayout: 'content',
columns: ['title', 'status'],
schema: {
...base,
route: articleRoute,
summary: articleSummary(ARTICLES),
dates,
tags: fields.multiRelationship({
label: 'Tags',
collection: TAGS,
}),
content: content(ARTICLES),
},
})

View File

@@ -0,0 +1,11 @@
import { ARTICLES, PAGES, TAGS } from '@/lib/constants/collections'
import { articles } from './articles'
import { pages } from './pages'
import { tags } from './tags'
export const contentCollections = {
[ARTICLES]: articles,
[PAGES]: pages,
[TAGS]: tags,
}

View File

@@ -0,0 +1,23 @@
import { collection } from '@keystatic/core'
import { base } from '@/keystatic/fields/content/base'
import { content } from '@/keystatic/fields/content/content'
import { pageRoute } from '@/keystatic/fields/content/route'
import { pageSummary } from '@/keystatic/fields/content/summary'
import { PAGES } from '@/lib/constants/collections'
export const pages = collection({
label: 'Pages',
slugField: 'title',
path: `src/content/general/${PAGES}/*`,
format: {
contentField: 'content',
},
columns: ['title', 'status'],
schema: {
...base,
route: pageRoute,
summary: pageSummary,
content: content(PAGES),
},
})

View File

@@ -0,0 +1,21 @@
import { collection, fields } from '@keystatic/core'
import { title } from '@/keystatic/fields/content/base'
import { TAGS } from '@/lib/constants/collections'
export const tags = collection({
label: 'Tags',
slugField: 'title',
path: `src/content/general/${TAGS}/*`,
format: {
data: 'json',
},
columns: ['title'],
schema: {
title,
description: fields.text({
label: 'Description',
multiline: true,
}),
},
})