Skip to content

Instantly share code, notes, and snippets.

@kmelve
Last active February 23, 2024 01:27
Show Gist options
  • Save kmelve/7ad0db2bc67c9f63009bfbc29bc83710 to your computer and use it in GitHub Desktop.
Save kmelve/7ad0db2bc67c9f63009bfbc29bc83710 to your computer and use it in GitHub Desktop.
Super simple galleries on Sanity.io
/*
$ sanity init
# Follow steps, choose the clean template
# go to schemas/schema.js and paste this in
*/
// 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'
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'default',
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([{
name: 'gallery',
type: 'document',
title: 'Gallery',
fields: [
{
name: 'images',
type: 'array', // supports drag'n'drop of multiple files
options: {
layout: 'grid'
},
of: [{
type: 'image'
}]
}
]
},
/* More types here! */
])
})
@borosmate
Copy link

Thank you soo soo much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment