mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 21:07:46 +00:00
66 lines
1.1 KiB
JavaScript
66 lines
1.1 KiB
JavaScript
export default {
|
|
name: 'post',
|
|
title: 'Post',
|
|
type: 'document',
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
title: 'Title',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'slug',
|
|
title: 'Slug',
|
|
type: 'slug',
|
|
options: {
|
|
source: 'title',
|
|
maxLength: 96,
|
|
},
|
|
},
|
|
{
|
|
name: 'author',
|
|
title: 'Author',
|
|
type: 'reference',
|
|
to: {type: 'author'},
|
|
},
|
|
{
|
|
name: 'mainImage',
|
|
title: 'Main image',
|
|
type: 'image',
|
|
options: {
|
|
hotspot: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'categories',
|
|
title: 'Categories',
|
|
type: 'array',
|
|
of: [{type: 'reference', to: {type: 'category'}}],
|
|
},
|
|
{
|
|
name: 'publishedAt',
|
|
title: 'Published at',
|
|
type: 'datetime',
|
|
},
|
|
{
|
|
name: 'body',
|
|
title: 'Body',
|
|
type: 'blockContent',
|
|
},
|
|
],
|
|
|
|
preview: {
|
|
select: {
|
|
title: 'title',
|
|
author: 'author.name',
|
|
media: 'mainImage',
|
|
},
|
|
prepare(selection) {
|
|
const {author} = selection
|
|
return Object.assign({}, selection, {
|
|
subtitle: author && `by ${author}`,
|
|
})
|
|
},
|
|
},
|
|
}
|