-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.config.ts
50 lines (48 loc) · 1.79 KB
/
sanity.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use client";
/**
* This config is used to set up Sanity Studio that's mounted on the `app/(sanity)/studio/[[...tool]]/page.tsx` route
*/
import { visionTool } from "@sanity/vision";
import { PluginOptions, defineConfig } from "sanity";
import { unsplashImageAsset } from "sanity-plugin-asset-source-unsplash";
import { presentationTool } from "sanity/presentation";
import { structureTool } from "sanity/structure";
import { apiVersion, dataset, projectId, studioUrl } from "@/sanity/lib/api";
import { locate } from "@/sanity/plugins/locate";
import { pageStructure, singletonPlugin } from "@/sanity/plugins/settings";
import { assistWithPresets } from "@/sanity/plugins/assist";
import author from "@/sanity/schemas/documents/author";
import post from "@/sanity/schemas/documents/post";
import settings from "@/sanity/schemas/singletons/settings";
export default defineConfig({
basePath: studioUrl,
projectId,
dataset,
schema: {
types: [
// Singletons
settings,
// Documents
post,
author,
],
},
plugins: [
presentationTool({
locate,
previewUrl: { previewMode: { enable: "/api/draft" } },
}),
structureTool({ structure: pageStructure([settings]) }),
// Configures the global "new document" button, and document actions, to suit the Settings document singleton
singletonPlugin([settings.name]),
// Add an image asset source for Unsplash
unsplashImageAsset(),
// Sets up AI Assist with preset prompts
// https://www.sanity.io/docs/ai-assist
assistWithPresets(),
// Vision lets you query your content with GROQ in the studio
// https://www.sanity.io/docs/the-vision-plugin
process.env.NODE_ENV === "development" &&
visionTool({ defaultApiVersion: apiVersion }),
].filter(Boolean) as PluginOptions[],
});