93 lines
2.1 KiB
TypeScript
93 lines
2.1 KiB
TypeScript
import { defineField, defineType } from 'sanity'
|
|
|
|
export const articleType = defineType({
|
|
name: 'article',
|
|
title: 'Article',
|
|
type: 'document',
|
|
fields: [
|
|
defineField({
|
|
name: 'title',
|
|
type: 'string',
|
|
title: 'Title',
|
|
description: 'The title of the article',
|
|
}),
|
|
defineField({
|
|
name: 'slug',
|
|
type: 'slug',
|
|
title: 'Slug',
|
|
options: {
|
|
source: 'title',
|
|
maxLength: 96,
|
|
},
|
|
}),
|
|
defineField({
|
|
name: 'excerpt',
|
|
type: 'text',
|
|
title: 'Excerpt',
|
|
description: 'A short summary of the article',
|
|
}),
|
|
defineField({
|
|
name: 'content',
|
|
type: 'array',
|
|
title: 'Content',
|
|
of: [
|
|
{
|
|
type: 'block',
|
|
styles: [
|
|
{ title: 'Normal', value: 'normal' },
|
|
{ title: 'Heading 1', value: 'h1' },
|
|
{ title: 'Heading 2', value: 'h2' },
|
|
{ title: 'Quote', value: 'blockquote' },
|
|
],
|
|
lists: [
|
|
{ title: 'Bullet', value: 'bullet' },
|
|
{ title: 'Numbered', value: 'number' },
|
|
],
|
|
marks: {
|
|
decorators: [
|
|
{ title: 'Bold', value: 'strong' },
|
|
{ title: 'Italic', value: 'em' },
|
|
],
|
|
annotations: [
|
|
{
|
|
name: 'link',
|
|
type: 'object',
|
|
title: 'Link',
|
|
fields: [
|
|
{
|
|
name: 'href',
|
|
type: 'url',
|
|
title: 'URL',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
type: 'image',
|
|
options: {
|
|
hotspot: true,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'alt',
|
|
type: 'string',
|
|
title: 'Alternative Text',
|
|
description: 'Description of the image for accessibility purposes',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}),
|
|
defineField({
|
|
name: 'image',
|
|
type: 'image',
|
|
title: 'Main Image',
|
|
options: {
|
|
hotspot: true,
|
|
},
|
|
}),
|
|
],
|
|
})
|