From be5c10f1c300e6f4d386b1258bf35cef46fa6f0c Mon Sep 17 00:00:00 2001 From: giancarlo Date: Thu, 2 May 2024 11:29:30 +0700 Subject: [PATCH] Simplified path parameter in createKeyStaticConfig function The explicit path parameter has been removed from the createKeyStaticConfig function. It now uses direct paths for the 'posts' and 'documentation' collections, instead of constructing them through an environment variable. This could help make the code simpler and cleaner. --- packages/cms/keystatic/src/keystatic.config.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/cms/keystatic/src/keystatic.config.ts b/packages/cms/keystatic/src/keystatic.config.ts index e2c3e3360..19efb7da0 100644 --- a/packages/cms/keystatic/src/keystatic.config.ts +++ b/packages/cms/keystatic/src/keystatic.config.ts @@ -30,9 +30,7 @@ const storage = z.union([local, cloud, github]).parse({ pathPrefix: process.env.KEYSTATIC_PATH_PREFIX, }); -const path = process.env.NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH ?? './content'; - -const keyStaticConfig = createKeyStaticConfig(path); +const keyStaticConfig = createKeyStaticConfig(); export default keyStaticConfig; @@ -40,14 +38,14 @@ export type PostEntryProps = Entry< (typeof keyStaticConfig)['collections']['posts'] >; -function createKeyStaticConfig(path: string) { +function createKeyStaticConfig() { return config({ storage, collections: { posts: collection({ label: 'Posts', slugField: 'title', - path: `${path}/posts/*`, + path: `posts/*`, format: { contentField: 'content' }, schema: { title: fields.slug({ name: { label: 'Title' } }), @@ -88,7 +86,7 @@ function createKeyStaticConfig(path: string) { documentation: collection({ label: 'Documentation', slugField: 'title', - path: `${path}/documentation/**`, + path: `documentation/**`, format: { contentField: 'content' }, schema: { title: fields.slug({ name: { label: 'Title' } }),