Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Issue with document types not showing up in Sanity Studio after following a tutorial.

7 replies
Last updated: Jul 31, 2023
Hello everyone, quick intro, Im User an aspiring creative technologist, have recently dabbled with nextjs and now Im starting up onto Sanity.
I have been following this tutorial -
https://www.youtube.com/watch?v=OcTPaUfay5I&t=2363s I have followed all the steps up to 37:18 and when I navigate to localhost:3000/admin, it says I have no document types

Any clue how I can solve this problem, happy to share code with whoever is willing to help.

Big thanks in advance. Sorry in advance for coding newbie-ness
Jul 30, 2023, 7:57 PM
So sounds like sanity isnt picking up any definitions. In the tutorial project you can see the config file here - https://github.com/kapehe-ok/next-sanity-test/blob/main/sanity.config.ts I would check if your schema objects are coming through properly
Jul 30, 2023, 8:20 PM
Check your
index.ts
file to see if the schemas that you have defined are included in the
const
like here .You can then check if that
const
is included in the
sanity.config.ts
file like here .
Relevant Docs .
Jul 31, 2023, 10:49 AM
sanity.config.ts

_import_ { defineConfig } _from_ "sanity";

_import_ { deskTool } _from_ "sanity/desk";

_import_ schemas _from_ "./sanity/schemas/index";


const config = defineConfig({

projectId: "my-token-ID",


dataset: "production",


title: "User Sanity Next Studio",


apiVersion: "2023-07-31",


basePath: "/admin",


plugins: [deskTool()],


schemas: { types: schemas },

});


export
_default_ config;

sanity/index.ts


_import_ project _from_ "./project-schema";


const schemas = [project];


export
_default_ schemas;

@/admin[[…index]]/ page.tsx


"use client";


_import_ config _from_ "@/sanity.config";

_import_ { NextStudio } _from_ "next-sanity/studio";


export
_default_ function AdmitPage() {

_return_ <NextStudio _config_={config} />;

}
Jul 31, 2023, 5:15 PM
Oh and this is my project schema file

const project = {

name: "project",

title: "Projects",

type: "document",

fields: [

{

name: "name",

title: "Name",

type: "string",

},

{

name: "slug",

title: "Slug",

type: "slug",

options: { source: "name" },

},

{

name: "image",

title: "Image",

type: "image",

options: { hotspot: true },

fields: [

{

name: "alt",

title: "Alt",

type: "string",

},

],

},

{

name: "url",

title: "URL",

type: "url",

},

{

name: "content",

title: "Content",

type: "array",

of: [{ type: "block" }],

},

],

};


export
_default_ project;
Jul 31, 2023, 5:16 PM
Can you folks identify any problems with these as I have tried what you just mentioned, and nothing you suggested seem to make a difference. I really appreciate your help
Jul 31, 2023, 5:17 PM
Let’s use greetings like “Hey Everyone,” “Hi, Y’all," or “Hello, Folks” to make sure everyone in the community is included. Please read the Sanity Community Code of Conduct to stay updated on expected communication &amp; behavior in our spaces: https://www.sanity.io/docs/community-code-of-conduct
Jul 31, 2023, 5:17 PM
Upon starting everything fresh sanity seems to work fine. Thanks for all you efforts anyway! Have a brilliant day
Jul 31, 2023, 6:15 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?