# Project Structure

Understand the files Dahlia needs and choose a layout for root, prefixed, or localized docs.

import { FileTree, Steps } from '@prosefly/astro-components';

Dahlia separates four concerns: Astro integration in `astro.config.ts`, content
collection setup in `src/content.config.ts`, site configuration in
`theme.config.json`, and documentation content in `src/content/docs`. Start with
the root layout below, then change only the part your project needs.

## Docs At Root

Use this for a documentation-only site. It matches Dahlia defaults and does not
need an explicit `docsBase`.

<FileTree iconSet="vscode-icons">

- astro.config.ts registers the Dahlia integration
- theme.config.json uses the default `docsBase: '/'`
- src
  - content.config.ts registers the docs collection
  - content
    - docs
      - index.mdx homepage at `/`
      - installation.mdx
      - components
        - icon.mdx
- public
  - favicon.svg

</FileTree>

With this setup, `installation.mdx` renders at `/installation/`, and its
Markdown route is `/installation.md`.

## Homepage + Docs

Use this when the site needs a top-level marketing or product homepage at `/`
and documentation under `/docs`.

<FileTree iconSet="vscode-icons">

- astro.config.ts registers the Dahlia integration
- theme.config.json sets `docsBase: '/docs'`
- src
  - content.config.ts registers the docs collection
  - pages
    - index.astro site homepage at `/`
  - content
    - docs
      - index.mdx docs homepage at `/docs/`
      - overview.mdx
      - installation.mdx
- public
  - images
    - logo.svg
  - favicon.svg

</FileTree>

This structure keeps `docsLoader()` focused on `src/content/docs`. Use the
exported Dahlia layouts when the custom homepage should share the same header,
footer, tokens, and theme initialization as the docs pages.

## Localized Docs

Use this when each locale has its own content directory.

<FileTree iconSet="vscode-icons">

- src
  - content.config.ts registers the docs collection
  - content
    - docs
      - en
        - index.mdx
        - overview.mdx
        - configuration
          - project.mdx
      - zh-cn
        - index.mdx
        - overview.mdx
        - configuration
          - project.mdx
- theme.config.json maps locale directories

</FileTree>

Sidebar strings stay locale-neutral. Reference `configuration/project`, not
`en/configuration/project`.

## With Overrides

Use this when the project replaces shell components or adds local UI around the
Dahlia theme.

<FileTree iconSet="vscode-icons">

- src
  - content.config.ts
  - content
    - docs
      - index.mdx
      - overview.mdx
  - components
    - dahlia
      - HeaderSocialIcons.astro
      - PageActions.astro
      - SearchDialog.astro
  - styles
    - dahlia.css optional custom CSS tokens
- theme.config.json references local override paths
- public
  - logo.svg
  - favicon.svg

</FileTree>

Keep local overrides outside `src/content` so content remains portable and
route-focused.

<Steps>

1. **Pick the route model first.**

   Decide whether docs live under `/docs` or `/`, and whether the site has a
   separate homepage.

2. **Add locale directories only when translations exist.**

   A single-language site can use `src/content/docs`. A localized site should
   move pages under directories such as `src/content/docs/en` and
   `src/content/docs/zh-cn`.

3. **Keep content, theme config, and overrides separate.**

   Put content in `src/content`, site configuration in `theme.config.json`,
   and local shell overrides in `src/components`.

</Steps>

See [Content Routing](/docs/configuration/content-routing/) and
[Internationalization](/docs/configuration/i18n/) for route and locale behavior.
