跳转至主内容
Version: 2.0.0-alpha.74

迁移概览

此文档将教授您如何将现有的 Docusaurus 1 网站更新至 Docusaurus 2。

我们尽力精简这一流程,且提供了迁移 CLI 工具。

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
信息

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:

  • 软件包
  • CLI 命令
  • 站点配置
  • Markdown 文件
  • 侧边栏文件
  • 页面、 组件和 CSS
  • 分版文档
  • i18n 支持🚧

自动迁移流程#

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.

迁移合并请求示例#

您可以参考我们为 Create React AppFlux 提交的迁移合并请求来了解如何迁移简单的 Docusaurus v1 网站。