Aller au contenu

Remplacements

Référence du schéma des options de configuration de l’intégration StudioCMS

studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
dbStartPage?: boolean | undefined;
imageService?: {
cdnPlugin?: "cloudinary-js" | undefined;
} | undefined;
defaultFrontEndConfig?: boolean | {
htmlDefaultLanguage?: string | undefined;
htmlDefaultHead?: {
tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";
attrs?: Record<string, string | boolean | undefined> | undefined;
content?: string | undefined;
}[] | undefined;
favicon?: string | undefined;
injectQuickActionsMenu?: boolean | undefined;
} | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
AuthConfig?: {
providers?: {
github?: boolean | undefined;
discord?: boolean | undefined;
google?: boolean | undefined;
auth0?: boolean | undefined;
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string ...

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?: {
CustomImageOverride?: string | undefined;
FormattedDateOverride?: string | undefined;
} | undefined
overrides
: {
CustomImageOverride?: string | undefined
CustomImageOverride
: 'src/components/CustomImage.astro',
FormattedDateOverride?: string | undefined
FormattedDateOverride
: 'src/components/FormattedDate.astro',
},
});

CustomImageOverride est une chaîne de caractères utilisée pour déterminer le chemin d’accès au composant d’image personnalisé.

  • Type : string
  • Par défaut : undefined
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
dbStartPage?: boolean | undefined;
imageService?: {
cdnPlugin?: "cloudinary-js" | undefined;
} | undefined;
defaultFrontEndConfig?: boolean | {
htmlDefaultLanguage?: string | undefined;
htmlDefaultHead?: {
tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";
attrs?: Record<string, string | boolean | undefined> | undefined;
content?: string | undefined;
}[] | undefined;
favicon?: string | undefined;
injectQuickActionsMenu?: boolean | undefined;
} | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
AuthConfig?: {
providers?: {
github?: boolean | undefined;
discord?: boolean | undefined;
google?: boolean | undefined;
auth0?: boolean | undefined;
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string ...

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?: {
CustomImageOverride?: string | undefined;
FormattedDateOverride?: string | undefined;
} | undefined
overrides
: {
CustomImageOverride?: string | undefined
CustomImageOverride
: 'src/components/CustomImage.astro',
},
})

FormattedDateOverride est une chaîne de caractères utilisée pour déterminer le chemin d’accès au composant de date personnalisé.

  • Type : string
  • Par défaut : undefined
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
dbStartPage?: boolean | undefined;
imageService?: {
cdnPlugin?: "cloudinary-js" | undefined;
} | undefined;
defaultFrontEndConfig?: boolean | {
htmlDefaultLanguage?: string | undefined;
htmlDefaultHead?: {
tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";
attrs?: Record<string, string | boolean | undefined> | undefined;
content?: string | undefined;
}[] | undefined;
favicon?: string | undefined;
injectQuickActionsMenu?: boolean | undefined;
} | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
AuthConfig?: {
providers?: {
github?: boolean | undefined;
discord?: boolean | undefined;
google?: boolean | undefined;
auth0?: boolean | undefined;
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string ...

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?: {
CustomImageOverride?: string | undefined;
FormattedDateOverride?: string | undefined;
} | undefined
overrides
: {
FormattedDateOverride?: string | undefined
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>