init sanity

This commit is contained in:
Dean 2025-01-23 15:27:10 -08:00
parent 7fc6e921df
commit 8d69b3c488
2 changed files with 95 additions and 1 deletions

View File

@ -0,0 +1,92 @@
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,
},
}),
],
})

View File

@ -1 +1,3 @@
export const schemaTypes = []
import {articleType} from './articleType'
export const schemaTypes = [articleType]