Skip to content

Repository files navigation

Astro Theme Dahlia

Dahlia is an installable documentation theme for Astro 7. It provides docs routing, navigation, search, i18n, MDX components, Expressive Code, Mermaid, dark mode, and a configurable documentation shell.

Dahlia documentation theme preview

Create a new site

Use the maintained starter template:

pnpm create astro@latest my-docs --template prosefly/astro-template-dahlia-starter
cd my-docs
pnpm dev

Starter source: prosefly/astro-template-dahlia-starter

Add Dahlia to an Astro project

Install the theme:

pnpm add @prosefly/astro-theme-dahlia

Register the integration:

// astro.config.ts
import { defineConfig } from 'astro/config';
import dahlia from '@prosefly/astro-theme-dahlia';

export default defineConfig({
  integrations: [dahlia()],
});

Register the docs collection:

// src/content.config.ts
import { defineCollection } from 'astro:content';
import { docsLoader, docsSchema } from '@prosefly/astro-theme-dahlia/content';

const docs = defineCollection({
  loader: docsLoader(),
  schema: docsSchema(),
});

export const collections = { docs };

Create theme.config.json:

{
  "$schema": "https://prosefly.dev/schema/dahlia.json",
  "name": "Acme Docs",
  "description": "Documentation for Acme.",
  "docsNav": [
    {
      "label": "Guide",
      "icon": "lucide:book-open",
      "items": ["index"]
    }
  ]
}

Create src/content/docs/index.mdx:

---
title: Overview
description: Learn how to use Acme.
---

Welcome to the Acme documentation.

Run pnpm dev and open http://localhost:4321/.

Install @prosefly/astro-components directly when your own MDX imports shared components or when astro.config.ts customizes the Astro Components integration. Dahlia otherwise registers that integration with default options.

Documentation

Package scripts

pnpm lint
pnpm test
pnpm check
pnpm build

License

BSD-3-Clause

Releases

Packages

Contributors

Languages