跳转至主内容
Version: 2.0.0-beta.0

迁移概览

This doc guides you through migrating an existing Docusaurus 1 site to Docusaurus 2.

We try to make this as easy as possible, and provide a migration cli.

Main differences#

Docusaurus 1 is a pure documentation site generator, using React as a server-side template engine, but not loading React on the browser.

Docusaurus 2 is rebuilt it from the ground up, generates a single-page-application, using the full power of React in the browser. It allows for more customizability but preserved the best parts of Docusaurus 1 - easy to get started, versioned docs, and i18n.

除此之外,Docusaurus 2 还是一款性能卓越的静态网站生成器,您还可用它来快速创建常见的内容驱动站点。(如开发文档、博客、产品着陆及营销页面)

虽然我们的重心仍是为您又快又好地呈现开发文档,但您也可以让 Docusaurus 2 如其他的 React 应用一般构建出任意类型的网站。 Docusaurus 现已可以构建任意类型的站点,不单单局限于开发文档网站。

Docusaurus 1 架构#

Your Docusaurus 1 site should have the following structure:

├── docs
└── website
├── blog
├── core
│ └── Footer.js
├── package.json
├── pages
├── sidebars.json
├── siteConfig.js
└── static

Docusaurus 2 架构#

After the migration, your Docusaurus 2 site could look like:

├── docs
└── website
├── blog
├── src
│ ├── components
│ ├── css
│ └── pages
├── static
├── package.json
├── sidebars.json
├── docusaurus.config.js
info

This migration does not change the /docs folder location, but Docusaurus v2 sites generally have the /docs folder inside /website

You are free to put the /docs folder anywhere you want after having migrated to v2.

迁移流程#

There are multiple things to migrate to obtain a fully functional Docusaurus 2 website:

  • packages
  • cli commands
  • site configuration
  • markdown files
  • sidebars file
  • pages, components and CSS
  • versioned docs
  • i18n support 🚧

自动迁移流程#

The migration cli will handle many things of the migration for you.

However, some parts can't easily be automated, and you will have to fallback to the manual process.

note

We recommend running the migration cli, and complete the missing parts thanks to the manual migration process.

手动迁移流程#

Some parts of the migration can't be automated (particularly the pages), and you will have to migrate them manually.

The manual migration guide will give you all the manual steps.

支持#

For any questions, you can ask in the #docusaurus-1-to-2-migration Discord channel.

Feel free to tag @slorber in any migration PRs if you would like us to have a look.

We also have volunteers willing to help you migrate your v1 site.

迁移合并请求示例#

You might want to refer to our migration PRs for Create React App and Flux as examples of how a migration for a basic Docusaurus v1 site can be done.