Last active
February 23, 2024 01:27
-
-
Save kmelve/7ad0db2bc67c9f63009bfbc29bc83710 to your computer and use it in GitHub Desktop.
Super simple galleries on Sanity.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
$ 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! */ | |
]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love you 😭