# Configuration

## `minidocs(options?)`

The Astro integration, the default export of `@minidocs/astro`, added to `integrations` in `astro.config.mjs`.

| Option                | Type                                 | Default | What it does                                                                                           |
| --------------------- | ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------ |
| `fallback`            | `Record<string, string \| string[]>` | `{}`    | Locales to try in order when a page is not translated, such as `{ en: 'zh' }`. Requires Astro’s `i18n` |
| `markdown.directives` | `boolean`                            | `true`  | Whether `:::tip[Title]` callouts are supported                                                         |
| `markdown.alerts`     | `boolean`                            | `true`  | Whether GitHub’s `> [!TIP]` callouts are supported                                                     |

minidocs also reads these settings of your Astro config:

| Astro setting                           | Effect                                                                                            |
| --------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `i18n.locales`, `i18n.defaultLocale`    | The locale directories of content and the locale segment of URLs. `locales` must be plain strings |
| `i18n.routing.prefixDefaultLocale`      | Whether URLs of the default locale have a locale segment                                          |
| `base`, `trailingSlash`, `build.format` | The prefix and trailing slash of links                                                            |
| `site`                                  | Links in llms.txt and llms-full.txt become full URLs                                              |

`i18n.routing: 'manual'` and Astro’s `i18n.fallback` are not supported and report an error when set.

## `glob(options)`

Imported from `@minidocs/astro/loaders`. It is Astro’s `glob` loader and takes all of its options, plus:

| Option   | Type                 | Default       | What it does                                                                                                                                 |
| -------- | -------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `prefix` | `string`             | The site root | The path pages live under, such as `docs` for pages under `/docs/`                                                                           |
| `filter` | `(entry) => boolean` |               | Entries it returns `false` for never enter the collection. `entry` has `id`, `data` and `filePath`, and `data` has been parsed by the schema |

The collection’s schema needs `title: string`, the label of a page in the sidebar and in llms.txt.

Collections loaded with it get types for their page ids, can be targets of file links in content, and work with `listPages`, `toHref` and `toMarkdown`. When pages of two collections share a URL, syncing content reports an error.
