2024-04-14 14:47:52 +02:00
|
|
|
import { config, fields, collection } from '@keystatic/core';
|
2024-04-15 14:54:57 +02:00
|
|
|
import ShowableFigureIcon from './keystatic/content-components/ShowableFigureIcon';
|
2024-04-19 21:32:01 +02:00
|
|
|
import { mark, wrapper } from '@keystatic/core/content-components';
|
2024-04-21 03:00:27 +02:00
|
|
|
import ShowableFigureView from './keystatic/content-components/ShowableFigure';
|
2024-04-19 18:33:07 +02:00
|
|
|
import FootnoteIcon from 'keystatic/content-components/FootnoteIcon';
|
2024-04-14 14:47:52 +02:00
|
|
|
|
|
|
|
export default config({
|
2024-04-15 14:54:57 +02:00
|
|
|
ui: {
|
|
|
|
brand: { name: 'Filipe Medeiros CMS' },
|
|
|
|
},
|
2024-04-21 03:00:27 +02:00
|
|
|
// customCSS: `
|
|
|
|
// .footnote-content::before {
|
|
|
|
// content: '^';
|
|
|
|
// font-size: initial;
|
|
|
|
// }
|
|
|
|
// .footnote-content {
|
|
|
|
// font-size: 0rem;
|
|
|
|
// }
|
|
|
|
// .footnote-content:hover, .footnote-content:focus {
|
|
|
|
// font-size: smaller;
|
|
|
|
// }
|
|
|
|
// .footnote-content:hover::before, .footnote-content:focus::before {
|
|
|
|
// content: '> ';
|
|
|
|
// }
|
|
|
|
// `,
|
2024-04-14 14:47:52 +02:00
|
|
|
storage: {
|
|
|
|
kind: 'local',
|
|
|
|
},
|
|
|
|
collections: {
|
|
|
|
library: collection({
|
|
|
|
label: 'Library items',
|
2024-04-15 14:54:57 +02:00
|
|
|
slugField: 'title',
|
2024-04-14 14:47:52 +02:00
|
|
|
path: 'src/content/library/**',
|
2024-04-19 21:32:01 +02:00
|
|
|
columns: ['title', 'date'],
|
2024-04-14 14:47:52 +02:00
|
|
|
schema: {
|
2024-04-15 14:54:57 +02:00
|
|
|
title: fields.slug({
|
|
|
|
name: {
|
|
|
|
label: 'Title',
|
|
|
|
validation: { isRequired: true },
|
|
|
|
},
|
2024-04-14 14:47:52 +02:00
|
|
|
}),
|
2024-04-19 18:33:07 +02:00
|
|
|
subtitle: fields.text({ label: 'Subtitle' }),
|
2024-04-14 14:47:52 +02:00
|
|
|
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 } }),
|
2024-04-19 18:33:07 +02:00
|
|
|
mainAuthors: fields.array(fields.text({ label: 'Author' }), {
|
|
|
|
label: 'Main author(s)',
|
|
|
|
}),
|
2024-04-14 14:47:52 +02:00
|
|
|
},
|
|
|
|
}),
|
2024-04-15 14:54:57 +02:00
|
|
|
posts: collection({
|
|
|
|
label: 'Blog posts',
|
2024-04-19 21:32:01 +02:00
|
|
|
columns: ['title', 'publishDate'],
|
2024-04-15 14:54:57 +02:00
|
|
|
entryLayout: 'content',
|
|
|
|
slugField: 'slug',
|
|
|
|
path: 'src/content/blog/**',
|
|
|
|
format: { contentField: 'body' },
|
|
|
|
schema: {
|
|
|
|
slug: fields.slug({
|
|
|
|
name: {
|
|
|
|
label: 'Astro slug',
|
|
|
|
validation: { isRequired: true },
|
|
|
|
},
|
|
|
|
slug: {
|
|
|
|
generate: (astroSlug) => astroSlug,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
title: fields.text({
|
|
|
|
label: 'Title',
|
|
|
|
validation: { isRequired: true },
|
|
|
|
}),
|
2024-04-19 18:33:07 +02:00
|
|
|
body: fields.mdx({
|
2024-04-15 14:54:57 +02:00
|
|
|
label: 'Body',
|
|
|
|
components: {
|
2024-04-15 21:02:34 +02:00
|
|
|
ShowableFigure: wrapper({
|
2024-04-15 14:54:57 +02:00
|
|
|
label: 'Showable figure',
|
2024-04-21 03:00:27 +02:00
|
|
|
ContentView: ShowableFigureView,
|
2024-04-15 14:54:57 +02:00
|
|
|
icon: ShowableFigureIcon(),
|
|
|
|
schema: {
|
2024-04-19 14:51:33 +02:00
|
|
|
image: fields.image({
|
2024-04-15 21:02:34 +02:00
|
|
|
label: 'Image',
|
2024-04-19 14:51:33 +02:00
|
|
|
directory: 'src/assets/images/blog',
|
|
|
|
publicPath: '/src/assets/images/blog/',
|
2024-04-15 21:02:34 +02:00
|
|
|
}),
|
|
|
|
altText: fields.text({
|
|
|
|
label: 'Alt text',
|
|
|
|
validation: { isRequired: true },
|
|
|
|
}),
|
2024-04-15 14:54:57 +02:00
|
|
|
},
|
2024-04-15 21:02:34 +02:00
|
|
|
}),
|
2024-04-19 18:33:07 +02:00
|
|
|
Footnote: mark({
|
|
|
|
label: 'Footnote',
|
|
|
|
icon: FootnoteIcon(),
|
2024-04-21 03:00:27 +02:00
|
|
|
tag: 'sup',
|
|
|
|
className: 'footnote-content',
|
2024-04-19 18:33:07 +02:00
|
|
|
schema: {},
|
|
|
|
}),
|
2024-04-15 14:54:57 +02:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
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(
|
|
|
|
{
|
2024-04-19 14:51:33 +02:00
|
|
|
image: fields.image({
|
|
|
|
label: 'Image',
|
|
|
|
directory: 'src/assets/images/blog',
|
|
|
|
publicPath: '@assets/images/blog/',
|
2024-04-15 14:54:57 +02:00
|
|
|
validation: { isRequired: true },
|
|
|
|
}),
|
|
|
|
altText: fields.text({
|
|
|
|
label: 'Alt text',
|
|
|
|
validation: { isRequired: true },
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
{ label: 'Image' },
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{ label: 'Link preview' },
|
|
|
|
),
|
|
|
|
},
|
|
|
|
}),
|
2024-04-14 14:47:52 +02:00
|
|
|
},
|
|
|
|
});
|