Skip to content

Astro Configuration

The CMS integration is added to your astro.config.ts file. It accepts an optional configuration object to customize its behavior.

astro.config.ts
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import cms from "astronaut-cms";
export default defineConfig({
integrations: [mdx(), react(), cms()],
});

Pass options to cms() to customize the integration:

astro.config.ts
cms({
mountPoint: "/admin",
locale: "en",
storage: { type: "local" },
media: {
repo: { directory: "src/assets", maxFileSize: 10_000_000 },
},
});
  • Type: string
  • Default: "/admin"

The URL path where the admin panel is served.

@astrojs/sitemap lists every page route, the admin included, and another integration cannot take one out. Exclude it with the sitemap’s filter. The integration warns when a built sitemap still lists the admin, provided sitemap() comes before cms() in integrations, since it reads the files the sitemap wrote.

astro.config.ts
sitemap({ filter: (page) => !new URL(page).pathname.startsWith("/admin") });
  • Type: string
  • Default: auto-discovered from src/cms.config.{ts,mts,js,mjs}

Path to the CMS config file, relative to the project root.

  • Type: "en" | "de"
  • Default: "en"

Default language for the admin panel UI. Editors can change it from the header, and their choice is remembered.

  • Type: { locales?: string[]; defaultLocale?: string } | false
  • Default: inherited from the site’s own i18n in astro.config.ts

Content languages. Set it to override the site’s languages, or to false to keep the admin language-agnostic. See the Multilingual Content guide for details.

  • Type: StorageConfig
  • Default: { type: "local" }

Storage backend configuration. See the Storage Backends guide for details.

  • Type: MediaConfig
  • Default: { repo: { directory: "src/assets" } }

The media libraries: the repository library, and optionally an object store beside it. See the Media Library guide for details.