😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Dev Mode

By Ollie Taylor

List all schemas in development

structure.js

import S from "@sanity/desk-tool/structure-builder";

const structureListAll = S.listItem()
	.title("All Document Types")
	.child(
		S.list()
			.title("All Types")
			.items([
				/* This returns an array of all the document types defined in the schema.*/
				...S.documentTypeListItems(),
			]),
	);

export default () =>
	S.list()
		.title("Content Management")
		.items([
			//...YOUR STRUCTURE
			process.env.NODE_ENV === "development" ? structureListAll : S.divider(),
		]);

This snippet will list all your schema types in your studio. This can be great for debugging in development.

You can leave this snippet in when you deploy as it will not render in production.

Contributor

Ollie Taylor

A multi­dimensional designer with a healthy obsession for code

Ollie is located at Staines-Upon-Thames, UK
Visit Ollie Taylor's profile