Katie Kodes
Databases by day; web to get in trouble
Katie is located at United States of America
A teeny-tiny 1-document-type schema
import createSchema from 'part:@sanity/base/schema-creator';
import schemaTypes from 'all:part:@sanity/base/schema-type';
import page from './page';
export default createSchema({
name: 'default',
types: schemaTypes.concat([
page,
]),
});
export default {
name: 'page',
title: 'Page',
type: 'document',
icon,
fields: [
{
name: 'template',
title: 'Template',
type: 'string',
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
description:
'If not happy with what the system generated, you can hand-edit it here',
},
{
name: 'message',
title: 'Message',
type: 'string',
},
],
preview: {
select: {
slug: 'slug',
template: 'template',
message: 'message',
},
prepare(selection) {
const { slug, template, message } = selection;
return {
title: `${slug.current} [${template}]`,
subtitle: message,
};
},
},
};
Just 2 files to go into your Sanity Studio codebase's `schemas` folder -- not enough to be overwhelmed and wonder what things do!
See the "'Hello World' from scratch" community guide to try it yourself.
Databases by day; web to get in trouble