Saltearse al contenido

config

Esta página aún no está disponible en tu idioma.

function defineStudioCMSConfig(config:
| undefined
| {
componentRegistry: Record<string, string>;
dbStartPage: boolean;
features: {
authConfig: {
enabled: boolean;
providers: {
usernameAndPassword: boolean;
usernameAndPasswordConfig: {
allowUserRegistration: ... | ... | ...;
};
};
};
dashboardConfig: {
dashboardEnabled: boolean;
dashboardRouteOverride: string;
faviconURL: string;
inject404Route: boolean;
versionCheck: boolean;
};
developerConfig: {
demoMode: | false
| {
password: string;
username: string;
};
};
injectQuickActionsMenu: boolean;
preferredImageService: string;
robotsTXT: | boolean
| {
host: string | boolean;
policy: {
allow: string | ...[];
cleanParam: string | ...[];
crawlDelay: number;
disallow: string | ...[];
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"
| "Yandex"
| "YandexMobileBot"
| "Algolia Crawler"
| "BublupBot"
| "CCBot"
| "Cliqzbot"
| "Daumoa"
| "DeuSu"
| "EuripBot"
| "Exploratodo"
| "Feedly"
| "Findxbot"
| "istellabot"
| "JikeSpider"
| "Lycos"
| "Mail.Ru"
| "MojeekBot"
| "OrangeBot"
| "Pinterest"
| "Plukkie"
| "Qwantify"
| "Rambler"
| "SemanticScholarBot"
| "SeznamBot"
| "Sosospider"
| "Slurp"
| "Twitterbot"
| "WhatsApp"
| "yacybot"
| "YepBot"
| "Yeti"
| "YioopBot"
| "yoozBot"
| "YoudaoBot"
| ...[];
}[];
sitemap: string | boolean | string[];
};
sdk: | boolean
| {
cacheConfig: | boolean
| {
lifetime: string;
};
};
};
locale: {
dateLocale: string;
dateTimeFormat: DateTimeFormatOptions;
};
logLevel: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None";
plugins: StudioCMSPlugin[];
verbose: boolean;
}):
| undefined
| {
componentRegistry: Record<string, string>;
dbStartPage: boolean;
features: {
authConfig: {
enabled: boolean;
providers: {
usernameAndPassword: boolean;
usernameAndPasswordConfig: {
allowUserRegistration: ... | ... | ...;
};
};
};
dashboardConfig: {
dashboardEnabled: boolean;
dashboardRouteOverride: string;
faviconURL: string;
inject404Route: boolean;
versionCheck: boolean;
};
developerConfig: {
demoMode: | false
| {
password: string;
username: string;
};
};
injectQuickActionsMenu: boolean;
preferredImageService: string;
robotsTXT: | boolean
| {
host: string | boolean;
policy: {
allow: string | ...[];
cleanParam: string | ...[];
crawlDelay: number;
disallow: string | ...[];
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"
| "Yandex"
| "YandexMobileBot"
| "Algolia Crawler"
| "BublupBot"
| "CCBot"
| "Cliqzbot"
| "Daumoa"
| "DeuSu"
| "EuripBot"
| "Exploratodo"
| "Feedly"
| "Findxbot"
| "istellabot"
| "JikeSpider"
| "Lycos"
| "Mail.Ru"
| "MojeekBot"
| "OrangeBot"
| "Pinterest"
| "Plukkie"
| "Qwantify"
| "Rambler"
| "SemanticScholarBot"
| "SeznamBot"
| "Sosospider"
| "Slurp"
| "Twitterbot"
| "WhatsApp"
| "yacybot"
| "YepBot"
| "Yeti"
| "YioopBot"
| "yoozBot"
| "YoudaoBot"
| ...[];
}[];
sitemap: string | boolean | string[];
};
sdk: | boolean
| {
cacheConfig: | boolean
| {
lifetime: string;
};
};
};
locale: {
dateLocale: string;
dateTimeFormat: DateTimeFormatOptions;
};
logLevel: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None";
plugins: StudioCMSPlugin[];
verbose: boolean;
}

Defined in: studiocms/packages/studiocms/src/config.ts:33^

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.

undefined |

{ componentRegistry: Record<string, string>; dbStartPage: boolean; features: { authConfig: { enabled: boolean; providers: { usernameAndPassword: boolean; usernameAndPasswordConfig: { allowUserRegistration: … | … | …; }; }; }; dashboardConfig: { dashboardEnabled: boolean; dashboardRouteOverride: string; faviconURL: string; inject404Route: boolean; versionCheck: boolean; }; developerConfig: { demoMode: | false | { password: string; username: string; }; }; injectQuickActionsMenu: boolean; preferredImageService: string; robotsTXT: | boolean | { host: string | boolean; policy: { allow: string | …[]; cleanParam: string | …[]; crawlDelay: number; disallow: string | …[]; 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" | "Yandex" | "YandexMobileBot" | "Algolia Crawler" | "BublupBot" | "CCBot" | "Cliqzbot" | "Daumoa" | "DeuSu" | "EuripBot" | "Exploratodo" | "Feedly" | "Findxbot" | "istellabot" | "JikeSpider" | "Lycos" | "Mail.Ru" | "MojeekBot" | "OrangeBot" | "Pinterest" | "Plukkie" | "Qwantify" | "Rambler" | "SemanticScholarBot" | "SeznamBot" | "Sosospider" | "Slurp" | "Twitterbot" | "WhatsApp" | "yacybot" | "YepBot" | "Yeti" | "YioopBot" | "yoozBot" | "YoudaoBot" | …[]; }[]; sitemap: string | boolean | string[]; }; sdk: | boolean | { cacheConfig: | boolean | { lifetime: string; }; }; }; locale: { dateLocale: string; dateTimeFormat: DateTimeFormatOptions; }; logLevel: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None"; plugins: StudioCMSPlugin[]; verbose: boolean; }

Record<string, string> = ...

Component Registry

boolean = ...

Project Initialization Page - Used during First Time Setup to initialize the database

Default

true

{ authConfig: { enabled: boolean; providers: { usernameAndPassword: boolean; usernameAndPasswordConfig: { allowUserRegistration: … | … | …; }; }; }; dashboardConfig: { dashboardEnabled: boolean; dashboardRouteOverride: string; faviconURL: string; inject404Route: boolean; versionCheck: boolean; }; developerConfig: { demoMode: | false | { password: string; username: string; }; }; injectQuickActionsMenu: boolean; preferredImageService: string; robotsTXT: | boolean | { host: string | boolean; policy: { allow: string | …[]; cleanParam: string | …[]; crawlDelay: number; disallow: string | …[]; 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" | "Yandex" | "YandexMobileBot" | "Algolia Crawler" | "BublupBot" | "CCBot" | "Cliqzbot" | "Daumoa" | "DeuSu" | "EuripBot" | "Exploratodo" | "Feedly" | "Findxbot" | "istellabot" | "JikeSpider" | "Lycos" | "Mail.Ru" | "MojeekBot" | "OrangeBot" | "Pinterest" | "Plukkie" | "Qwantify" | "Rambler" | "SemanticScholarBot" | "SeznamBot" | "Sosospider" | "Slurp" | "Twitterbot" | "WhatsApp" | "yacybot" | "YepBot" | "Yeti" | "YioopBot" | "yoozBot" | "YoudaoBot" | …[]; }[]; sitemap: string | boolean | string[]; }; sdk: | boolean | { cacheConfig: | boolean | { lifetime: string; }; }; } = ...

Allows adjusting the StudioCMS Dashboard features

{ enabled: boolean; providers: { usernameAndPassword: boolean; usernameAndPasswordConfig: { allowUserRegistration: … | … | …; }; }; } = authConfigSchema

Auth Configuration - Allows customization of the Authentication Configuration

boolean = ...

Auth Enabled - Allows enabling or disabling of the Authentication Configuration

Default

true

{ usernameAndPassword: boolean; usernameAndPasswordConfig: { allowUserRegistration: … | … | …; }; } = authProviderSchema

Auth Providers - Allows enabling or disabling of the Authentication Providers

features.authConfig.providers.usernameAndPassword?
Section titled “features.authConfig.providers.usernameAndPassword?”

boolean = ...

Username and Password Auth Provider

features.authConfig.providers.usernameAndPasswordConfig?
Section titled “features.authConfig.providers.usernameAndPasswordConfig?”

{ allowUserRegistration: … | … | …; } = localUsernameAndPasswordConfig

features.authConfig.providers.usernameAndPasswordConfig.allowUserRegistration?
Section titled “features.authConfig.providers.usernameAndPasswordConfig.allowUserRegistration?”

… | … | … = ...

Allow User Registration - Allows users to register an account

Default

false

{ dashboardEnabled: boolean; dashboardRouteOverride: string; faviconURL: string; inject404Route: boolean; versionCheck: boolean; } = dashboardConfigSchema

Allows customization of the Dashboard Configuration

features.dashboardConfig.dashboardEnabled?
Section titled “features.dashboardConfig.dashboardEnabled?”

boolean = ...

OPTIONAL - This allows the user to enable or disable the Astro StudioCMS dashboard but still provide all the helper’s and utilities to those who are customizing their setup, doing so will disable the dashboard and you will need to manage your content via your database

Default

true
features.dashboardConfig.dashboardRouteOverride?
Section titled “features.dashboardConfig.dashboardRouteOverride?”

string = ...

OPTIONAL - This allows the user to override the default dashboard route to a custom route

Note: Use with caution, this is an advanced feature

Usage

  • The default route is dashboard without any / or \ characters. If you want to override the route to /admin you would set this value to admin

Default

"dashboard"

string = ...

OPTIONAL - This allows the user to override the default Favicon URL to a custom URL

boolean = ...

OPTIONAL - This allows the user to enable or disable the default 404 route for the dashboard

Default

true

boolean = ...

OPTIONAL - This allows the user to enable or disable the version check for the dashboard

This will check for the latest version of StudioCMS and notify the user if there is a new version available.

Default

true

{ demoMode: | false | { password: string; username: string; }; } = developerConfigSchema

Developer Options/Configuration

| false | { password: string; username: string; } = ...

Enable demo mode for the site

If set to an object, the site will be in demo mode, and the user will be able to login with the provided username and password.

Default

false

Example

{
demoMode: {
username: "demo_user",
password: "some-demo-password"
}
}

boolean = ...

Enable Quick Actions Menu - Whether to enable the quick actions menu which allows easy access to your dashboard while logged in on non-dashboard pages.

Default

true

string = ...

Set the identifier of the Preferred Image Service

Requires an Image Service to be installed such as ‘cloudinary-js’

| boolean | { host: string | boolean; policy: { allow: string | …[]; cleanParam: string | …[]; crawlDelay: number; disallow: string | …[]; 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" | "Yandex" | "YandexMobileBot" | "Algolia Crawler" | "BublupBot" | "CCBot" | "Cliqzbot" | "Daumoa" | "DeuSu" | "EuripBot" | "Exploratodo" | "Feedly" | "Findxbot" | "istellabot" | "JikeSpider" | "Lycos" | "Mail.Ru" | "MojeekBot" | "OrangeBot" | "Pinterest" | "Plukkie" | "Qwantify" | "Rambler" | "SemanticScholarBot" | "SeznamBot" | "Sosospider" | "Slurp" | "Twitterbot" | "WhatsApp" | "yacybot" | "YepBot" | "Yeti" | "YioopBot" | "yoozBot" | "YoudaoBot" | …[]; }[]; sitemap: string | boolean | string[]; } = ...

Allows the user to enable/disable the use of the StudioCMS Custom astro-robots-txt Integration

Default

robotsTXT: { policy: [ { userAgent: ['*'], allow: ['/'], disallow: ['/dashboard/'] } ] }

| boolean | { cacheConfig: | boolean | { lifetime: string; }; } = SDKSchema

SDKSchema is a Zod schema that validates the SDK configuration. It can either be a boolean or an object containing cache configuration.

If it is a boolean, it defaults to true and transforms into an object with default cache configuration.

If it is an object, it must contain the cacheConfig property which is validated by the SDKCacheSchema.

{ dateLocale: string; dateTimeFormat: DateTimeFormatOptions; } = ...

Locale specific settings

string = ...

Date Locale used for formatting dates

DateTimeFormatOptions = ...

DateTime Format Options

"All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" = ...

Set the LogLevel for Effect based code

StudioCMSPlugin[] = ...

Add Plugins to the StudioCMS

boolean = ...

Whether to show verbose output

Default

false

| undefined | { componentRegistry: Record<string, string>; dbStartPage: boolean; features: { authConfig: { enabled: boolean; providers: { usernameAndPassword: boolean; usernameAndPasswordConfig: { allowUserRegistration: … | … | …; }; }; }; dashboardConfig: { dashboardEnabled: boolean; dashboardRouteOverride: string; faviconURL: string; inject404Route: boolean; versionCheck: boolean; }; developerConfig: { demoMode: | false | { password: string; username: string; }; }; injectQuickActionsMenu: boolean; preferredImageService: string; robotsTXT: | boolean | { host: string | boolean; policy: { allow: string | …[]; cleanParam: string | …[]; crawlDelay: number; disallow: string | …[]; 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" | "Yandex" | "YandexMobileBot" | "Algolia Crawler" | "BublupBot" | "CCBot" | "Cliqzbot" | "Daumoa" | "DeuSu" | "EuripBot" | "Exploratodo" | "Feedly" | "Findxbot" | "istellabot" | "JikeSpider" | "Lycos" | "Mail.Ru" | "MojeekBot" | "OrangeBot" | "Pinterest" | "Plukkie" | "Qwantify" | "Rambler" | "SemanticScholarBot" | "SeznamBot" | "Sosospider" | "Slurp" | "Twitterbot" | "WhatsApp" | "yacybot" | "YepBot" | "Yeti" | "YioopBot" | "yoozBot" | "YoudaoBot" | …[]; }[]; sitemap: string | boolean | string[]; }; sdk: | boolean | { cacheConfig: | boolean | { lifetime: string; }; }; }; locale: { dateLocale: string; dateTimeFormat: DateTimeFormatOptions; }; logLevel: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None"; plugins: StudioCMSPlugin[]; verbose: boolean; }

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

Re-exports StudioCMSOptions