generated from sanity-io/nextjs-blog-cms-sanity-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsanity.config.ts
68 lines (64 loc) · 2.95 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* This config is used to set up Sanity Studio that's mounted on the `/pages/studio/[[...index]].tsx` route
*/
import { visionTool } from '@sanity/vision';
import { apiVersion, dataset, previewSecretId, projectId } from 'lib/sanity.api';
import { previewDocumentNode } from 'plugins/previewPane';
import { productionUrl } from 'plugins/productionUrl';
import { settingsPlugin, settingsStructure } from 'plugins/settings';
import { defineConfig } from 'sanity';
import { StructureBuilder, structureTool } from 'sanity/structure';
import { unsplashImageAsset } from 'sanity-plugin-asset-source-unsplash';
// Sanity Schema types
import agentType from 'schemas/agent';
import authorType from 'schemas/author';
import listingType from 'schemas/listing';
import contactObject from 'schemas/objects/contact';
import formObject from 'schemas/objects/form';
import galleryObject from 'schemas/objects/gallery';
import heroObject from 'schemas/objects/hero';
import linkObject from 'schemas/objects/link';
import picture from 'schemas/objects/picture';
import pictureTitled from 'schemas/objects/pictureTitled';
import textWithIllustrationsObject from 'schemas/objects/textWithIllustrations';
import videoObject from 'schemas/objects/video';
import whyUsSection from 'schemas/objects/whyUsSection';
import whyUsCard from 'schemas/objects/whyUsSection/whyUsCard';
import pageType from 'schemas/pageBuilder';
import postType from 'schemas/post';
import rentals from 'schemas/rentals';
import settingsType from 'schemas/settings';
import vacationRentas from 'schemas/vacationRentas';
const title = process.env.NEXT_PUBLIC_SANITY_PROJECT_TITLE || 'Playacar Homes Realty';
const objectTypes = [heroObject, textWithIllustrationsObject, galleryObject, formObject, videoObject, linkObject, contactObject, picture, pictureTitled, whyUsSection, whyUsCard];
const documentTypes = [pageType, postType, settingsType, listingType, rentals, vacationRentas, agentType, authorType];
export default defineConfig({
basePath: '/studio',
projectId,
dataset,
title,
schema: {
// If you want more content types, you can add them to this array
types: [...documentTypes, ...objectTypes],
},
plugins: [
structureTool({
structure: settingsStructure(settingsType),
// `defaultDocumentNode` is responsible for adding a “Preview” tab to the document pane
defaultDocumentNode: previewDocumentNode({ apiVersion, previewSecretId }),
}),
// Configures the global "new document" button, and document actions, to suit the Settings document singleton
settingsPlugin({ type: settingsType.name }),
// Add the "Open preview" action
productionUrl({
apiVersion,
previewSecretId,
types: [postType.name, settingsType.name],
}),
// Add an image asset source for Unsplash
unsplashImageAsset(),
// Vision lets you query your content with GROQ in the studio
// https://www.sanity.io/docs/the-vision-plugin
visionTool({ defaultApiVersion: apiVersion }),
],
});