콘텐츠로 이동

재정의

StudioCMS 통합 구성 옵션 스키마 참조

studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | {
host?: string | boolean | undefined;
sitemap?: string | boolean | string[] | undefined;
policy?: {
userAgent?: "360Spider" | "360Spider-Image" | "360Spider-Video" | "HaoSouSpider" | "AdsBot-Google" | "AdsBot-Google-Mobile" | "AdsBot-Google-Mobile-Apps" | "Googlebot" | "Googlebot-Image" | "Googlebot-Mobile" | "Googlebot-News" | "Googlebot-Video" | "Mediapartners-Google" | "adidxbot" | "bingbot" | "BingPreview" | "MicrosoftPreview" | "msnbot" | "msnbot-media" | "Applebot" | "AppleNewsBot" | "Baiduspider" | "Baiduspider-image" | "Baiduspider-mobile" | "Baiduspider-news" | "Baiduspider-video" | "coccoc" | "coccocbot-image" | "coccocbot-web" | "DuckDuckBot" | "DuckDuckGo-Favicons-Bot" | "facebookcatalog" | "facebookexternalhit" | "Facebot" | "gooblog" | "ichiro" | "Sogou blog" | "Sogou inst spider" | "Sogou News Spider" | "Sogou Orion spider" | "Sogou spider2" | "Sogou web spider" ...

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
({
overrides: {
Error ts(2353) ― Object literal may only specify known properties, and 'overrides' does not exist in type '{ plugins?: StudioCMSPlugin[] | undefined; logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined; dbStartPage?: boolean | undefined; verbose?: boolean | undefined; componentRegistry?: Record<...> | undefined; locale?: { ...; } | undefined; features?: { ...; } | undefined; }'.
type CustomImageOverride: string
CustomImageOverride
: 'src/components/CustomImage.astro',
type FormattedDateOverride: string
FormattedDateOverride
: 'src/components/FormattedDate.astro',
},
});

CustomImageOverride는 사용자 정의 이미지 컴포넌트의 경로를 결정하는 데 사용되는 문자열입니다.

  • 타입: string
  • 기본값: undefined
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | {
host?: string | boolean | undefined;
sitemap?: string | boolean | string[] | undefined;
policy?: {
userAgent?: "360Spider" | "360Spider-Image" | "360Spider-Video" | "HaoSouSpider" | "AdsBot-Google" | "AdsBot-Google-Mobile" | "AdsBot-Google-Mobile-Apps" | "Googlebot" | "Googlebot-Image" | "Googlebot-Mobile" | "Googlebot-News" | "Googlebot-Video" | "Mediapartners-Google" | "adidxbot" | "bingbot" | "BingPreview" | "MicrosoftPreview" | "msnbot" | "msnbot-media" | "Applebot" | "AppleNewsBot" | "Baiduspider" | "Baiduspider-image" | "Baiduspider-mobile" | "Baiduspider-news" | "Baiduspider-video" | "coccoc" | "coccocbot-image" | "coccocbot-web" | "DuckDuckBot" | "DuckDuckGo-Favicons-Bot" | "facebookcatalog" | "facebookexternalhit" | "Facebot" | "gooblog" | "ichiro" | "Sogou blog" | "Sogou inst spider" | "Sogou News Spider" | "Sogou Orion spider" | "Sogou spider2" | "Sogou web spider" ...

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
({
overrides: {
Error ts(2353) ― Object literal may only specify known properties, and 'overrides' does not exist in type '{ plugins?: StudioCMSPlugin[] | undefined; logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined; dbStartPage?: boolean | undefined; verbose?: boolean | undefined; componentRegistry?: Record<...> | undefined; locale?: { ...; } | undefined; features?: { ...; } | undefined; }'.
type CustomImageOverride: string
CustomImageOverride
: 'src/components/CustomImage.astro',
},
})

FormattedDateOverride는 사용자 정의 날짜 컴포넌트의 경로를 결정하는 데 사용되는 문자열입니다.

  • 타입: string
  • 기본값: undefined
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | {
host?: string | boolean | undefined;
sitemap?: string | boolean | string[] | undefined;
policy?: {
userAgent?: "360Spider" | "360Spider-Image" | "360Spider-Video" | "HaoSouSpider" | "AdsBot-Google" | "AdsBot-Google-Mobile" | "AdsBot-Google-Mobile-Apps" | "Googlebot" | "Googlebot-Image" | "Googlebot-Mobile" | "Googlebot-News" | "Googlebot-Video" | "Mediapartners-Google" | "adidxbot" | "bingbot" | "BingPreview" | "MicrosoftPreview" | "msnbot" | "msnbot-media" | "Applebot" | "AppleNewsBot" | "Baiduspider" | "Baiduspider-image" | "Baiduspider-mobile" | "Baiduspider-news" | "Baiduspider-video" | "coccoc" | "coccocbot-image" | "coccocbot-web" | "DuckDuckBot" | "DuckDuckGo-Favicons-Bot" | "facebookcatalog" | "facebookexternalhit" | "Facebot" | "gooblog" | "ichiro" | "Sogou blog" | "Sogou inst spider" | "Sogou News Spider" | "Sogou Orion spider" | "Sogou spider2" | "Sogou web spider" ...

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
({
overrides: {
Error ts(2353) ― Object literal may only specify known properties, and 'overrides' does not exist in type '{ plugins?: StudioCMSPlugin[] | undefined; logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined; dbStartPage?: boolean | undefined; verbose?: boolean | undefined; componentRegistry?: Record<...> | undefined; locale?: { ...; } | undefined; features?: { ...; } | undefined; }'.
type FormattedDateOverride: string
FormattedDateOverride
: 'src/components/FormattedDate.astro',
},
})
FormattedDate.astro
---
import config from 'studiocms:config';
interface Props {
date: Date;
}
const datetime = Astro.props.date.toISOString();
const formattedDate = Astro.props.date.toLocaleDateString(config.dateLocale, config.dateTimeFormat);
---
<time {datetime}>{formattedDate}</time>