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 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.
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 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.
Upgrading from 0.1.0
-
Move
prefixfromminidocs()to theglobof your docs collection:- minidocs({ prefix: 'docs' }) + minidocs() - glob({ base: './src/content/docs', pattern: '**/*.{md,mdx}' }) + glob({ base: './src/content/docs', pattern: '**/*.{md,mdx}', prefix: 'docs' }) -
Add the collection to
toHref:- toHref('index', locale) + toHref('docs', 'index', locale) -
Move
src/pages/[...path].astrotosrc/pages/[...locale]/docs/[...slug].astro, orsrc/pages/docs/[...slug].astroon single-language sites. On multilingual sites, movesrc/pages/[...path].md.tstosrc/pages/[...locale]/[...path].md.ts. Then use the new parameters:- params: { path: page.path } + params: page.params - params: { path: page.markdownPath } + params: page.markdownParams -
Replace
toPath, which is removed, in routes such as llms.txt:- params: { path: toPath('index', locale) } + params: { locale: toLocaleParam(locale) } -
On a multilingual site without a
prefix,/en.mdis now/en/index.md.
Every change is listed in CHANGELOG.md.