# 0.2.0

0.2.0 makes every collection on a site a first-class part of minidocs, not only the docs: a changelog or a blog gets its own prefix, typed ids and checked links. Routes also move to files that mirror their URLs, which changes the API, so see [Upgrading from 0.1.0](#upgrading-from-010) at the end.

## Multiple collections

Each collection loaded with minidocs’ `glob` takes its own `prefix`, and gets what the docs already had: typed ids, trees, Markdown versions and llms.txt.

```ts
glob({ base: './src/content/changelog', pattern: '**/*.md', prefix: 'changelog' });

toHref('changelog', 'v0.2.0', locale); // ids are checked per collection
```

File links work across collections and fail the build when the target is missing. A collection in one language on a multilingual site only needs `fallback`. Two pages that would share a URL fail content sync. See [Multiple Collections](/docs/guides/collections.md) for the details.

## Routes that mirror URLs

A page route now sits in the folder its collection’s `prefix` names, under `[...locale]` on multilingual sites, so the site’s own pages fit right beside it:

```
src/pages/[...locale]/
├── index.astro
├── docs/[...slug].astro
└── changelog/[...slug].astro
```

`page.params` holds the parameters of each page, and `toLocaleParam(locale)` gives the one for pages outside a collection. If a route ends up in the wrong folder, the build lists the pages it missed.

## One Markdown route

`src/pages/[...locale]/[...path].md.ts` serves the Markdown versions of every collection through `page.markdownParams`, and llms.txt can list several collections. See [Markdown and llms.txt](/docs/guides/markdown.md).

## Upgrading from 0.1.0

1. Move `prefix` from `minidocs()` to the `glob` of your docs collection:

   ```diff
   - minidocs({ prefix: 'docs' })
   + minidocs()
   - glob({ base: './src/content/docs', pattern: '**/*.{md,mdx}' })
   + glob({ base: './src/content/docs', pattern: '**/*.{md,mdx}', prefix: 'docs' })
   ```

2. Add the collection to `toHref`:

   ```diff
   - toHref('index', locale)
   + toHref('docs', 'index', locale)
   ```

3. Move `src/pages/[...path].astro` to `src/pages/[...locale]/docs/[...slug].astro`, or `src/pages/docs/[...slug].astro` on single-language sites. On multilingual sites, move `src/pages/[...path].md.ts` to `src/pages/[...locale]/[...path].md.ts`. Then use the new parameters:

   ```diff
   - params: { path: page.path }
   + params: page.params
   - params: { path: page.markdownPath }
   + params: page.markdownParams
   ```

4. Replace `toPath`, which is removed, in routes such as llms.txt:

   ```diff
   - params: { path: toPath('index', locale) }
   + params: { locale: toLocaleParam(locale) }
   ```

5. On a multilingual site without a `prefix`, `/en.md` is now `/en/index.md`.

Every change is listed in [CHANGELOG.md](https://github.com/Ivan-1F/minidocs/blob/main/CHANGELOG.md).
