# Docusaurus

> Docusaurus is the React-based static site generator optimized for documentation sites and blogs; consult when scaffolding with create-docusaurus, editing docusaurus.config.js or sidebars.js, authoring MDX docs, versioning, i18n, or running `npm run start`.

- Skill: `gabriel7silva/docusaurus` (Agent Skill)
- Install (CLI): `npx get-skill add gabriel7silva/docusaurus`
- Raw SKILL.md: https://api.skillmd.com/api/skills/gabriel7silva/docusaurus/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: gabriel7silva (https://skillmd.com/u/gabriel7silva)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/gabriel7silva/docusaurus

---


# Docusaurus

## Overview
Docusaurus (by Meta / the facebook org) is a static site generator that builds documentation websites and blogs as a React single-page app rendered to static HTML. It centers on MDX content, a `docs/` + `blog/` structure, versioning, and built-in i18n and search integrations. Read this when scaffolding a Docusaurus site, editing `docusaurus.config.js` or `sidebars.js`, authoring MDX, or configuring versioning and internationalization.

## Official sources
- Docs: https://docusaurus.io/docs
- Repo: https://github.com/facebook/docusaurus
- Install: https://docusaurus.io/docs/installation

## Install / setup
```bash
npx create-docusaurus@latest my-website classic
cd my-website
npm run start
```
Commands from the official installation docs: https://docusaurus.io/docs/installation

## Core concepts
- **Classic preset** — `@docusaurus/preset-classic` bundles the docs, blog, pages, and theme/CSS; configured under `presets` in the config.
- **`docusaurus.config.js`** — central site config (title, URL, presets, plugins, `themeConfig` for navbar/footer).
- **MDX content** — docs and blog posts are MDX, mixing Markdown with imported React components.
- **Sidebars** — `sidebars.js` defines the docs navigation tree (autogenerated from folders or hand-authored).
- **Docs versioning** — `npm run docusaurus docs:version <v>` snapshots docs so multiple versions ship side by side.
- **i18n** — built-in localization writes translations under `i18n/<locale>/` and builds per-locale sites.
- **Pages & swizzling** — standalone React/MDX pages live in `src/pages/`; "swizzling" overrides theme components for customization.

## Best practices
- Use **`create-docusaurus@latest ... classic`** to scaffold so you start from the supported preset (https://docusaurus.io/docs/installation).
- Pass `--typescript` to scaffold a typed config and components when you want TS (https://docusaurus.io/docs/installation).
- Cut new doc versions with **`docs:version`** rather than copying folders, to keep the version dropdown consistent (https://docusaurus.io/docs/versioning).
- Prefer **`--eject` swizzling sparingly** and favor `--wrap`, since wrapping survives upgrades better (https://docusaurus.io/docs/swizzling).

## Common pitfalls
- Broken internal links fail `npm run build` by default → fix the link or adjust `onBrokenLinks` in the config.
- Heavy use of ejected (swizzled) theme components → upgrades break; prefer wrapping or theme config where possible.

## Examples
```js
// docusaurus.config.js (excerpt)
export default {
  title: 'My Docs',
  url: 'https://example.com',
  baseUrl: '/',
  presets: [
    ['classic', { docs: { sidebarPath: './sidebars.js' }, blog: {} }],
  ],
};
```

## Further reading
- https://docusaurus.io/docs/category/guides — feature guides (docs, blog, versioning, i18n)
- https://docusaurus.io/docs/api/docusaurus-config — full config API reference

## Related skills
- ../astro — content framework with islands and partial hydration
- ../nextjs — React meta-framework for full-stack apps
- ../eleventy — JavaScript SSG with flexible template languages

