🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Astro Fundamentals••By Komal Nakrani

VuePress to Starlight: A Docs Migration Guide

Migrate a VuePress docs site to Starlight: move Markdown, convert containers to asides, rebuild the sidebar, swap Vue components and redirect old .html URLs.

#Astro#Starlight#VuePress#Migration#Documentation

To move from VuePress to Starlight, create a Starlight project, copy your Markdown into src/content/docs/, rename every README.md to index.md, convert VuePress containers (::: tip) to Starlight asides (:::tip), rebuild the sidebar in astro.config.mjs, and redirect the old .html URLs. Most VuePress Markdown works in Starlight unchanged, so the real work is in containers, Vue components and URLs.

Starlight is Astro’s official documentation theme. It gives you search, sidebar navigation, dark mode, i18n and accessible defaults, and builds to static HTML. This guide walks through a VuePress 1 or VuePress 2 migration step by step.

Key Takeaways

  • Markdown content and frontmatter mostly carry over; README.md files become index.md.
  • VuePress containers map to Starlight asides: tip to tip, warning to caution, danger to danger.
  • The sidebar moves from .vuepress/config to the starlight() integration options, and can be autogenerated from folders.
  • Vue components in Markdown need replacing with Starlight components or Astro components in .mdx files.
  • VuePress serves pages at /guide/intro.html; Starlight uses /guide/intro/, so add redirects.

What changes and what doesn’t

VuePress Starlight
docs/ folder with .vuepress/config.js or config.ts src/content/docs/ plus astro.config.mjs
README.md as folder index index.md (or index.mdx)
::: tip Title containers :::tip[Title] asides
::: details HTML <details> element
[[toc]] in a page Built-in “On this page” table of contents
Vue components in Markdown Starlight or Astro components in .mdx
home: true frontmatter template: splash with hero frontmatter
Search plugin (local or Algolia) Pagefind search built in
URLs ending in .html Directory URLs with a trailing slash

Headings, lists, tables, code blocks, images, links and standard frontmatter all keep working. If your docs are mostly plain Markdown, the migration can take an afternoon.

Step 1: Create the Starlight project

npm create astro@latest -- --template starlight my-docs
cd my-docs
npm run dev

The template creates src/content/docs/ for pages and a content config that registers the docs collection:

// src/content.config.ts
import { defineCollection } from 'astro:content';
import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';

export const collections = {
  docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};

Delete the example pages under src/content/docs/ once you’ve seen how they’re structured. The Astro project structure docs explain the other folders.

Step 2: Copy the Markdown and rename index files

Copy everything from your VuePress docs/ folder (except .vuepress/) into src/content/docs/. Then rename folder indexes:

# run from src/content/docs
find . -name 'README.md' -execdir mv README.md index.md \;

Move static assets from docs/.vuepress/public/ into the Astro project’s public/ folder so absolute paths like /images/logo.png keep resolving. Images referenced with relative paths can stay next to the Markdown files; Starlight optimises them at build time.

Every page needs a title in frontmatter. VuePress often took the title from the first # Heading. Starlight renders the title itself, so add title and remove the duplicate H1:

---
title: Installation
description: Install the CLI and create your first project.
---

Install the package with npm:

Step 3: Convert containers to asides

VuePress custom containers use ::: type with a space. Starlight asides use the Markdown directive syntax with no space, and the title goes in brackets. A small Node script handles the common cases:

// scripts/convert-containers.mjs
import { readFileSync, writeFileSync, globSync } from 'node:fs';

const map = { tip: 'tip', info: 'note', note: 'note', warning: 'caution', danger: 'danger' };

for (const file of globSync('src/content/docs/**/*.md')) {
  let text = readFileSync(file, 'utf8');
  text = text.replace(/^::: ?(tip|info|note|warning|danger)(?: (.+))?$/gm, (_, type, title) =>
    title ? `:::${map[type]}[${title.trim()}]` : `:::${map[type]}`,
  );
  text = text.replace(/^::: ?details(?: (.+))?\n([\s\S]*?)^:::$/gm, (_, title, body) =>
    `<details>\n<summary>${title ?? 'Details'}</summary>\n\n${body}\n</details>`,
  );
  text = text.replace(/^\[\[toc\]\]\s*$/gm, '');
  writeFileSync(file, text);
}

Run it with node scripts/convert-containers.mjs (fs.globSync needs Node.js 22 or later). Closing ::: lines stay as they are, since both tools use the same closing marker. Review the diff afterwards, because containers nested inside lists or code examples may need manual fixes.

Step 4: Rebuild the sidebar and navigation

VuePress defines the navbar and sidebar in .vuepress/config. In Starlight, configure the sidebar in the integration options. You can list pages by slug, or autogenerate groups from folders:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';

export default defineConfig({
  site: 'https://docs.example.com',
  integrations: [
    starlight({
      title: 'Example Docs',
      social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/example/project' }],
      editLink: { baseUrl: 'https://github.com/example/project/edit/main/' },
      sidebar: [
        { label: 'Start here', items: ['installation', 'quick-start'] },
        { label: 'Guides', autogenerate: { directory: 'guide' } },
        { label: 'Reference', autogenerate: { directory: 'reference' } },
      ],
    }),
  ],
});

Control order inside autogenerated groups with sidebar.order in each page’s frontmatter, and shorten labels with sidebar.label. Starlight has no separate top navbar config; top-level sections usually become sidebar groups, and external links go in social or as sidebar link items.

Step 5: Replace the homepage and Vue components

A VuePress homepage uses home: true with heroText, actions and features. In Starlight, turn src/content/docs/index.mdx into a splash page:

---
title: Example Docs
description: Everything you need to build with Example.
template: splash
hero:
  tagline: Build faster with Example.
  actions:
    - text: Get started
      link: /installation/
      icon: right-arrow
    - text: View on GitHub
      link: https://github.com/example/project
      variant: minimal
---

import { Card, CardGrid } from '@astrojs/starlight/components';

<CardGrid>
  <Card title="Fast" icon="rocket">Static pages with search built in.</Card>
  <Card title="Typed" icon="setting">Full TypeScript support.</Card>
</CardGrid>

Vue components used inside Markdown (<Badge>, <CodeGroup>, custom components in .vuepress/components/) won’t run in Starlight’s Markdown. Options:

  • Use Starlight’s built-ins. Badge, Tabs and TabItem, Steps, Card, LinkCard and Aside cover most VuePress theme components. Import them in an .mdx page.
  • Rewrite as Astro components. Most docs components are presentational and port in minutes.
  • Keep them in Vue. Add @astrojs/vue with npx astro add vue and use the component in .mdx with a client:* directive if it’s interactive.

Rename any page that uses components from .md to .mdx. The MDX guide covers imports and component props.

Step 6: Keep old URLs working

This is the step most migrations miss. VuePress builds guide/intro.md to /guide/intro.html. Starlight serves the same page at /guide/intro/. Every external link, bookmark and search result pointing to .html URLs will 404 unless you redirect.

The cleanest fix is a host-level 301 for each page. Generate the list from your content folder so nothing is missed:

// scripts/redirects.mjs
import { globSync, writeFileSync } from 'node:fs';

const lines = globSync('src/content/docs/**/*.{md,mdx}')
  .map((f) => f.replace('src/content/docs/', '').replace(/\.mdx?$/, ''))
  .filter((slug) => !slug.endsWith('index'))
  .map((slug) => `/${slug}.html /${slug}/ 301`);

writeFileSync('public/_redirects', lines.join('\n') + '\n');
console.log(`Wrote ${lines.length} redirects`);

That writes lines like /guide/intro.html /guide/intro/ 301 to public/_redirects, the format Netlify and Cloudflare Pages read. Folder indexes (/guide/ in both tools) don’t need a rule. For other hosts, the static hosting docs link each host’s redirect format. For a handful of pages, you can list them in Astro’s redirects option instead, which writes redirect pages at build time. The redirects tip compares both approaches.

Step 7: Search, i18n and deploy

Starlight builds a Pagefind search index on every production build, so remove VuePress search plugins and their config. If you used Algolia DocSearch and want to keep it, the @astrojs/starlight-docsearch plugin replaces the default search.

For multilingual VuePress sites (locales with /zh/ folders), Starlight’s locales and defaultLocale options use the same folder-per-language approach. Move each language folder under src/content/docs/ and set root for the default language if it has no prefix.

Then build and deploy:

npm run build
npx astro preview

The output in dist/ is static HTML and deploys to any static host. The official Starlight documentation covers every configuration option, and if you’re weighing Starlight against other tools first, see Starlight vs VitePress (VitePress is VuePress’s successor).

Migration checklist

  1. Starlight project created and running locally.
  2. Markdown copied into src/content/docs/, README.md renamed to index.md.
  3. Every page has a title and no duplicate H1.
  4. Containers converted to asides; [[toc]] removed.
  5. Sidebar rebuilt with groups and order.
  6. Homepage converted to a splash template.
  7. Vue components replaced or wrapped.
  8. Public assets moved to public/.
  9. .html URLs redirected with 301s.
  10. Search tested, site deployed, old URLs spot-checked.

If you want a custom-designed docs site rather than the Starlight look, Astro themes in the Documentation category are full Astro projects you can load the same Markdown into.

FAQ

Is Starlight a good replacement for VuePress?

Yes for most documentation sites. Starlight covers sidebar navigation, search, dark mode, i18n, asides and code highlighting out of the box, and it builds to static HTML. Sites that depend heavily on custom Vue components need more porting work.

Can I use Vue components in Starlight?

Yes. Install the Vue integration with npx astro add vue, then import Vue components into .mdx pages. Add a client:* directive only if the component needs to be interactive in the browser.

How do I convert VuePress containers to Starlight?

Change ::: tip to :::tip, ::: warning to :::caution and ::: danger to :::danger. Put custom titles in brackets, as in :::tip[Heads up]. Replace ::: details blocks with HTML <details> elements.

Will my VuePress URLs change in Starlight?

Usually. VuePress serves pages with a .html extension, while Starlight uses directory URLs with a trailing slash. Add 301 redirects from the old .html paths so links and search rankings carry over.

Should I migrate VuePress to VitePress or Starlight?

VitePress is the closer move if your docs rely on Vue components. Starlight suits teams who want Astro’s ecosystem, built-in Pagefind search, and the option to mix in components from any framework.