116 lines
3.5 KiB
TypeScript
116 lines
3.5 KiB
TypeScript
import { config, fields, collection } from '@keystatic/core';
|
|
import ShowableFigureIcon from './keystatic/content-components/ShowableFigureIcon';
|
|
import { block, wrapper } from '@keystatic/core/content-components';
|
|
import ShowableFigure from './keystatic/content-components/ShowableFigure';
|
|
|
|
export default config({
|
|
ui: {
|
|
brand: { name: 'Filipe Medeiros CMS' },
|
|
},
|
|
storage: {
|
|
kind: 'local',
|
|
},
|
|
collections: {
|
|
library: collection({
|
|
label: 'Library items',
|
|
slugField: 'title',
|
|
path: 'src/content/library/**',
|
|
schema: {
|
|
title: fields.slug({
|
|
name: {
|
|
label: 'Title',
|
|
validation: { isRequired: true },
|
|
},
|
|
}),
|
|
checkedOut: fields.checkbox({ label: 'Checked out?' }),
|
|
link: fields.url({ label: 'Link', validation: { isRequired: true } }),
|
|
description: fields.text({ label: 'Description', multiline: true }),
|
|
date: fields.date({ label: 'Date', validation: { isRequired: true } }),
|
|
mainAuthor: fields.text({ label: 'Main author(s)' }),
|
|
},
|
|
}),
|
|
posts: collection({
|
|
label: 'Blog posts',
|
|
entryLayout: 'content',
|
|
slugField: 'slug',
|
|
path: 'src/content/blog/**',
|
|
format: { contentField: 'body' },
|
|
schema: {
|
|
language: fields.select({
|
|
label: 'Language',
|
|
options: [
|
|
{ label: 'Português', value: 'pt' },
|
|
{ label: 'English', value: 'en' },
|
|
],
|
|
defaultValue: 'pt',
|
|
}),
|
|
slug: fields.slug({
|
|
name: {
|
|
label: 'Astro slug',
|
|
validation: { isRequired: true },
|
|
},
|
|
slug: {
|
|
generate: (astroSlug) => astroSlug,
|
|
},
|
|
}),
|
|
title: fields.text({
|
|
label: 'Title',
|
|
validation: { isRequired: true },
|
|
}),
|
|
body: fields.markdoc({
|
|
label: 'Body',
|
|
components: {
|
|
ShowableFigure: wrapper({
|
|
label: 'Showable figure',
|
|
ContentView: ShowableFigure,
|
|
icon: ShowableFigureIcon(),
|
|
schema: {
|
|
image: fields.image({
|
|
label: 'Image',
|
|
directory: 'src/assets/images/blog',
|
|
publicPath: '/src/assets/images/blog/',
|
|
}),
|
|
altText: fields.text({
|
|
label: 'Alt text',
|
|
validation: { isRequired: true },
|
|
}),
|
|
},
|
|
}),
|
|
},
|
|
}),
|
|
subtitle: fields.text({ label: 'Subtitle' }),
|
|
summary: fields.text({
|
|
label: 'Summary',
|
|
validation: { isRequired: true },
|
|
}),
|
|
publishDate: fields.date({
|
|
label: 'Publish date',
|
|
validation: { isRequired: true },
|
|
}),
|
|
linkPreview: fields.object(
|
|
{
|
|
title: fields.text({ label: 'Title' }),
|
|
description: fields.text({ label: 'Description' }),
|
|
image: fields.object(
|
|
{
|
|
image: fields.image({
|
|
label: 'Image',
|
|
directory: 'src/assets/images/blog',
|
|
publicPath: '@assets/images/blog/',
|
|
validation: { isRequired: true },
|
|
}),
|
|
altText: fields.text({
|
|
label: 'Alt text',
|
|
validation: { isRequired: true },
|
|
}),
|
|
},
|
|
{ label: 'Image' },
|
|
),
|
|
},
|
|
{ label: 'Link preview' },
|
|
),
|
|
},
|
|
}),
|
|
},
|
|
});
|