Skip to content

SDK

StudioCMS Integration config options schema reference

studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
dbStartPage?: boolean | undefined;
rendererConfig?: {
studiocms?: false | {
callouts?: false | {
theme?: "github" | "obsidian" | "vitepress" | undefined;
} | undefined;
autoLinkHeadings?: boolean | undefined;
discordSubtext?: boolean | undefined;
sanitize?: {
allowElements?: string[] | undefined;
blockElements?: string[] | undefined;
dropElements?: string[] | undefined;
allowAttributes?: Record<string, string[]> | undefined;
dropAttributes?: Record<string, string[]> | undefined;
allowComponents?: boolean | undefined;
allowCustomElements?: boolean | undefined;
allowComments?: boolean | undefined;
} | undefined;
} | undefined;
renderer?: "studiocms" | CustomRenderer | "astro" | "markdoc" | "mdx" | undefined;
markdocConfig?: {
renderType?: "html" | MarkdocRenderer | "react-static" | undefined;
argParse?: {
file?: string | undefined;
slots?: boolean | undefined;
location?: boolean | undefined;
} | undefined;
transformConfig?: {
tags?: Record<string, {}> | undefined;
validation?: {
parents?: any[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
...

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({
dbStartPage: true,
contentRenderer: 'marked',
verbose: true,
dateLocale: 'en-us',
// ...Other Options
})

defineStudioCMSConfig
({
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined
sdk
: {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined
cacheConfig
: {},
},
});

cacheConfig is an object that is used to configure the cache for the SDK.

  • Type: boolean | { lifetime?: string | undefined; } | undefined
  • Default: {}
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
dbStartPage?: boolean | undefined;
rendererConfig?: {
studiocms?: false | {
callouts?: false | {
theme?: "github" | "obsidian" | "vitepress" | undefined;
} | undefined;
autoLinkHeadings?: boolean | undefined;
discordSubtext?: boolean | undefined;
sanitize?: {
allowElements?: string[] | undefined;
blockElements?: string[] | undefined;
dropElements?: string[] | undefined;
allowAttributes?: Record<string, string[]> | undefined;
dropAttributes?: Record<string, string[]> | undefined;
allowComponents?: boolean | undefined;
allowCustomElements?: boolean | undefined;
allowComments?: boolean | undefined;
} | undefined;
} | undefined;
renderer?: "studiocms" | CustomRenderer | "astro" | "markdoc" | "mdx" | undefined;
markdocConfig?: {
renderType?: "html" | MarkdocRenderer | "react-static" | undefined;
argParse?: {
file?: string | undefined;
slots?: boolean | undefined;
location?: boolean | undefined;
} | undefined;
transformConfig?: {
tags?: Record<string, {}> | undefined;
validation?: {
parents?: any[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
...

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({
dbStartPage: true,
contentRenderer: 'marked',
verbose: true,
dateLocale: 'en-us',
// ...Other Options
})

defineStudioCMSConfig
({
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined
sdk
: {
// DEFAULT - This uses the default cache configuration.
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined
cacheConfig
: {
lifetime?: string | undefined
lifetime
: '5m',
},
}
})