Migrate from Starlight
Starlight stores documentation in Astro content collections and uses standard Markdown or MDX, so the Astro-to-Astro path is especially direct. The key work is translating sidebar configuration, Starlight components, expressive code options, and integration behavior.
Astro is the shortest target
If you want to keep the existing Astro application, initialize the Farming Labs Astro adapter and migrate only the docs integration and content wiring.
1. Inventory the source
Collect:
astro.config.*and thestarlight(...)integrationsrc/content/docs/Markdown and MDXsrc/content.config.*orsrc/content/config.*- manual and autogenerated sidebar definitions
src/components/and Starlight component overridessrc/styles/,public/, logos, favicons, and social images- plugins, expressive code config, locales, redirects, search, and custom head tags
2. Map the files
| Starlight | Farming Labs Docs |
|---|---|
src/content/docs/** | Target contentDir, commonly docs/** for Astro |
starlight({ sidebar }) | Directory hierarchy and page order |
Starlight title, description, and social config | docs.config.ts metadata and theme |
| component overrides | Theme config or registered Astro/MDX components |
src/styles/** | Global CSS or theme overrides |
public/** | Existing Astro public/** |
| Starlight plugins | Farming Labs feature config or explicit Astro integration |
Keep the existing Astro application when it contains non-doc routes; replace only the Starlight docs integration and route surface.
3. Preserve routes and frontmatter
Starlight normally derives docs routes from files under src/content/docs. Preserve directory and
filename slugs, then review:
titledescriptionslugsidebartableOfContentstemplateherobanner- edit and pagination settings
Portable title and description fields can remain. Translate layout, hero, banner, and sidebar objects into Farming Labs page content, theme configuration, or application UI.
4. Translate sidebar configuration
Starlight supports link items, groups, badges, translations, and autogenerated directories.
- Snapshot the fully resolved sidebar.
- Turn groups into directories with landing pages when useful.
- Add numeric
ordervalues matching manual item order. - Expand autogenerated directories into their actual page list.
- Preserve external links through custom navigation.
- Recreate labels and badges with stable text and registered icons.
Do not lose pages excluded from autogeneration; classify them as hidden, redirected, or retired.
5. Convert authoring features
| Starlight pattern | Target |
|---|---|
:::note, :::tip, :::caution, :::danger | Supported directive or <Callout> |
<Tabs> and <TabItem> | Built-in <Tabs> and <Tab> |
<Card> and <CardGrid> | Built-in cards or a registered component |
<Steps> | Ordered headings/list or a registered component |
| expressive-code mark/insert/delete metadata | Supported code fence metadata |
| Starlight icon names | Farming Labs icon registry |
| Astro component import | Keep for Astro or rewrite for another runtime |
Standard Markdown, headings, tables, links, and fenced code should remain unchanged.
6. Replace integration behavior
Map Starlight integration options intentionally:
- metadata and social images →
metadataandog - search →
search - edit links and page actions →
githubandpageActions - locales → Farming Labs locale configuration
- custom CSS → theme overrides and global CSS
- component overrides → theme config or registered components
- plugins → built-in feature config or a separate Astro integration
7. Validate and recover
- Run the Astro production build.
- Compare all
src/content/docsroutes and manual sidebar links. - Test autogenerated groups, badges, callouts, tabs, cards, and expressive code.
- Inspect locale navigation and base paths.
- Verify assets and application routes outside docs.
- Fetch representative pages through
.md.
If navigation is incomplete, compare the resolved Starlight sidebar with the target tree. If an Astro component fails after changing runtime, replace it with portable Markdown or a native target component.
Source references
Migrate Starlight Astro content, sidebar groups, frontmatter, expressive code, and components
How is this guide?