Skip to content

Instantly share code, notes, and snippets.

@TheEskhaton
Created June 2, 2020 09:36
Show Gist options
  • Save TheEskhaton/b4b0388663ac4c84893eb79bf3ef409c to your computer and use it in GitHub Desktop.
Save TheEskhaton/b4b0388663ac4c84893eb79bf3ef409c to your computer and use it in GitHub Desktop.
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'
// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'
// document schemas
import author from './documents/author'
import category from './documents/category'
import post from './documents/post'
import siteSettings from './documents/siteSettings'
// Object types
import bodyPortableText from './objects/bodyPortableText'
import bioPortableText from './objects/bioPortableText'
import excerptPortableText from './objects/excerptPortableText'
import mainImage from './objects/mainImage'
import authorReference from './objects/authorReference'
import gist from './objects/gist';
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'blog',
// Then proceed to concatenate our our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
// The following are document types which will appear
// in the studio.
siteSettings,
post,
category,
author,
mainImage,
authorReference,
bodyPortableText,
bioPortableText,
excerptPortableText,
gist
// When added to this list, object types can be used as
// { type: 'typename' } in other document schemas
])
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment