komal.nakrani
Browse Themes
ThemesCategoriesDocsBlogTips & Tricks
Docs/Working With Your Theme/Astro Configuration

Astro Configuration

The config file, the integrations your theme ships with, and what each one does.

Updated: September 2026·License: Commercial & Personal

astro.config.mjs

js
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://your-domain.com',
  trailingSlash: 'ignore',
  build: { format: 'directory' },
  integrations: [mdx(), sitemap()],
});

What each option does

  • site — your production URL. Required for the sitemap, RSS feed and canonical tags.
  • trailingSlash — how strictly URLs are matched. 'ignore' accepts both forms, which is the most forgiving across hosts.
  • build.format — 'directory' emits about/index.html rather than about.html, so URLs end in a slash.

Integrations

  • @astrojs/mdx — lets content files mix Markdown with components
  • @astrojs/sitemap — generates sitemap-index.xml at build time

Add an integration with the CLI, which installs it and wires up the config in one step:

bash
npx astro add sitemap
Explore production-ready themes

Hand-built Astro themes — SaaS, storefront, portfolio, and dashboard.

Browse All Themes ➔