config
Esta página aún no está disponible en tu idioma.
Functions
Section titled “Functions”defineStudioCMSConfig()
Section titled “defineStudioCMSConfig()”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.
Parameters
Section titled “Parameters”config
Section titled “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
;
}
componentRegistry?
Section titled “componentRegistry?”Record
<string
, string
> = ...
Component Registry
dbStartPage?
Section titled “dbStartPage?”boolean
= ...
Project Initialization Page - Used during First Time Setup to initialize the database
Default
true
features?
Section titled “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
;
};
};
} = ...
Allows adjusting the StudioCMS Dashboard features
features.authConfig?
Section titled “features.authConfig?”{
enabled
: boolean
;
providers
: {
usernameAndPassword
: boolean
;
usernameAndPasswordConfig
: {
allowUserRegistration
: … | … | …;
};
};
} = authConfigSchema
Auth Configuration - Allows customization of the Authentication Configuration
features.authConfig.enabled?
Section titled “features.authConfig.enabled?”boolean
= ...
Auth Enabled - Allows enabling or disabling of the Authentication Configuration
Default
true
features.authConfig.providers?
Section titled “features.authConfig.providers?”{
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
features.dashboardConfig?
Section titled “features.dashboardConfig?”{
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 toadmin
Default
"dashboard"
features.dashboardConfig.faviconURL?
Section titled “features.dashboardConfig.faviconURL?”string
= ...
OPTIONAL - This allows the user to override the default Favicon URL to a custom URL
features.dashboardConfig.inject404Route?
Section titled “features.dashboardConfig.inject404Route?”boolean
= ...
OPTIONAL - This allows the user to enable or disable the default 404 route for the dashboard
Default
true
features.dashboardConfig.versionCheck?
Section titled “features.dashboardConfig.versionCheck?”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
features.developerConfig?
Section titled “features.developerConfig?”{
demoMode
: | false
| {
password
: string
;
username
: string
;
};
} = developerConfigSchema
Developer Options/Configuration
features.developerConfig.demoMode?
Section titled “features.developerConfig.demoMode?”| 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"}}
features.injectQuickActionsMenu?
Section titled “features.injectQuickActionsMenu?”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
features.preferredImageService?
Section titled “features.preferredImageService?”string
= ...
Set the identifier of the Preferred Image Service
Requires an Image Service to be installed such as ‘cloudinary-js’
features.robotsTXT?
Section titled “features.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
[];
} = ...
Allows the user to enable/disable the use of the StudioCMS Custom astro-robots-txt
Integration
Default
robotsTXT: { policy: [ { userAgent: ['*'], allow: ['/'], disallow: ['/dashboard/'] } ] }
features.sdk?
Section titled “features.sdk?”| 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
.
locale?
Section titled “locale?”{
dateLocale
: string
;
dateTimeFormat
: DateTimeFormatOptions
;
} = ...
Locale specific settings
locale.dateLocale?
Section titled “locale.dateLocale?”string
= ...
Date Locale used for formatting dates
locale.dateTimeFormat?
Section titled “locale.dateTimeFormat?”DateTimeFormatOptions
= ...
DateTime Format Options
logLevel?
Section titled “logLevel?”"All"
| "Fatal"
| "Error"
| "Warning"
| "Info"
| "Debug"
| "Trace"
| "None"
= ...
Set the LogLevel for Effect based code
plugins?
Section titled “plugins?”StudioCMSPlugin
[] = ...
Add Plugins to the StudioCMS
verbose?
Section titled “verbose?”boolean
= ...
Whether to show verbose output
Default
false
Returns
Section titled “Returns”| 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
;
}
Example
Section titled “Example”import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({ dbStartPage: true, contentRenderer: 'marked', verbose: true, dateLocale: 'en-us', // ...Other Options})
References
Section titled “References”StudioCMSOptions
Section titled “StudioCMSOptions”Re-exports StudioCMSOptions