Skip to content

Commit 17dce1c

Browse files
committedJan 3, 2024
feat: add support for nuxt content schema
1 parent 885ba87 commit 17dce1c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

Diff for: ‎src/module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default defineNuxtModule<ModuleOptions>({
2929
properties: schema.properties?.appConfig,
3030
default: schema.default?.appConfig
3131
}
32+
nuxt.options.runtimeConfig.contentSchema = schema.properties?.content || {}
3233
})
3334

3435
// Support custom ~/.studio/app.config.json

Diff for: ‎src/runtime/server/routes/studio.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default eventHandler(async () => {
3131

3232
const appConfig = useAppConfig()
3333
const runtimeConfig = useRuntimeConfig()
34-
const { app, appConfigSchema, studio, content: { sources, ignores, locales, defaultLocale, highlight, navigation, documentDriven, experimental } } = runtimeConfig
34+
const { app, contentSchema, appConfigSchema, studio, content: { sources, ignores, locales, defaultLocale, highlight, navigation, documentDriven, experimental } } = runtimeConfig
3535

3636
// Delete GitHub tokens for multiple source to avoid exposing them
3737
const safeSources: any = {}
@@ -61,6 +61,8 @@ export default eventHandler(async () => {
6161
// Studio version
6262
version,
6363
tokens: studio?.publicToken,
64+
// nuxt.schema for Nuxt Content frontmatter
65+
contentSchema: contentSchema || {},
6466
// app.config
6567
appConfigSchema: appConfigSchema || {},
6668
appConfig,

0 commit comments

Comments
 (0)