StudioCMS-Konfiguration
Verfügbare Optionen
Abschnitt betitelt „Verfügbare Optionen“Es gibt zwei Möglichkeiten, die StudioCMS-Integration zu konfigurieren. Im Folgenden findest du Beispiele für die Konfiguration, je nachdem, ob du die Datei astro.config.mjs
oder die spezielle Datei studiocms.config.mjs
verwendest
Diese Seite zeigt dir, wie und wo du die StudioCMS-Konfiguration definieren kannst. Weitere Informationen zu den StudioCMS-Konfigurationsoptionen findest du auf der Referenzseite.
Verwendung der Datei astro.config.mjs
Abschnitt betitelt „Verwendung der Datei astro.config.mjs“import function db(): AstroIntegration[]
db from '@astrojs/db';import function node(userOptions: UserOptions): AstroIntegration
node from '@astrojs/node';import const studioCMS: (options?: { 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; username ...
StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
studioCMS from 'studiocms';import { function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never, const TFontFamilies extends FontFamily[] = never>(config: AstroUserConfig<TLocales, TDriver, TFontFamilies>): AstroUserConfig<TLocales, TDriver, TFontFamilies>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig } from 'astro/config';
export default defineConfig<never, never, never>(config: AstroUserConfig<never, never, never>): AstroUserConfig<never, never, never>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig({ AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.site?: string
site: 'https://demo.studiocms.dev/', AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.output?: "server" | "static"
output: 'server', AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.adapter?: AstroIntegration
adapter: function node(userOptions: UserOptions): AstroIntegration
node({ UserOptions.mode: "standalone" | "middleware"
Specifies the mode that the adapter builds to.
- 'middleware' - Build to middleware, to be used within another Node.js server, such as Express.
- 'standalone' - Build to a standalone server. The server starts up just by running the built script.
mode: "standalone" }), AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]
integrations: [ function db(): AstroIntegration[]
db(), function studioCMS(options?: { 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; username ...
StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
studioCMS({ dbStartPage?: boolean | undefined
dbStartPage: false, // andere Konfigurations-Optionen }), ],});
Verwendung der Datei studiocms.config.mjs
(empfohlen)
Abschnitt betitelt „Verwendung der Datei studiocms.config.mjs (empfohlen)“Diese Datei wird automatisch übernommen und überschreibt alle Optionen, die in der Datei astro.config.mjs
übergeben werden, wenn du diese Option verwendst. Bitte stelle sicher, dass du alle StudioCMS-Konfigurationsoptionen in diese Datei verschiebst, wie unten beschrieben:
Beispiel Dateistruktur
Abschnitt betitelt „Beispiel Dateistruktur“- .env
- astro.config.mjs
- studiocms.config.mjs
- studiocms-auth.config.json Automatisch generiert
- package.json
Directorysrc
- env.d.ts
- …
Beispiel Konfigurationsdateien
Abschnitt betitelt „Beispiel Konfigurationsdateien“import function db(): AstroIntegration[]
db from '@astrojs/db';import function node(userOptions: UserOptions): AstroIntegration
node from '@astrojs/node';import const studioCMS: (options?: { 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; username ...
StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
studioCMS from 'studiocms';import { function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never, const TFontFamilies extends FontFamily[] = never>(config: AstroUserConfig<TLocales, TDriver, TFontFamilies>): AstroUserConfig<TLocales, TDriver, TFontFamilies>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig } from 'astro/config';
export default defineConfig<never, never, never>(config: AstroUserConfig<never, never, never>): AstroUserConfig<never, never, never>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig({ AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.site?: string
site: 'https://demo.studiocms.dev/', AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.output?: "server" | "static"
output: 'server', AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.adapter?: AstroIntegration
adapter: function node(userOptions: UserOptions): AstroIntegration
node({ UserOptions.mode: "standalone" | "middleware"
Specifies the mode that the adapter builds to.
- 'middleware' - Build to middleware, to be used within another Node.js server, such as Express.
- 'standalone' - Build to a standalone server. The server starts up just by running the built script.
mode: "standalone" }), AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]
integrations: [ function db(): AstroIntegration[]
db(), function studioCMS(options?: { 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; username ...
StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
studioCMS() ],});
import { 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.
defineStudioCMSConfig } from "studiocms/config";
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.
defineStudioCMSConfig({ dbStartPage?: boolean | undefined
dbStartPage: false, // andere Konfigurations-Optionen})