From 6cb399e7267ae78e3e498bdbf5f51678ffb2cd45 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 21 Feb 2023 23:24:14 +0100 Subject: feat: Many things Configure sanity in same project as the app Implement type safe sanity schema Read localised documents Strip down design --- sanity.config.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sanity.config.ts (limited to 'sanity.config.ts') diff --git a/sanity.config.ts b/sanity.config.ts new file mode 100644 index 0000000..b2dbb81 --- /dev/null +++ b/sanity.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "sanity"; +import { visionTool } from "@sanity/vision"; +import schema from "./src/lib/sanity/schemas/default"; +import { withDocumentI18nPlugin } from "@sanity/document-internationalization"; +import { supportedLanguages } from "./src/lib/sanity/locales"; +import { languageFilter } from '@sanity/language-filter' + +export default defineConfig({ + name: "default", + title: "auroraklinikken.no", + projectId: process.env.SANITY_STUDIO_API_PROJECT_ID ?? "", + dataset: process.env.SANITY_STUDIO_API_DATASET ?? "", + plugins: withDocumentI18nPlugin([languageFilter({ + supportedLanguages: supportedLanguages, + }), (import.meta.env.DEV && visionTool() as any)], { + languages: supportedLanguages, + fallbackLanguageSelect: supportedLanguages.find((l) => l.isDefault)?.id as any, + }), + // @ts-ignore type mismatch + schema +}); -- cgit v1.3