All website material of https://nacos.io, which uses a open source framework: Docusaurus.
-
npm install
-
npm run start -- --locale en
for starting Nacos's English webpage in your local machine.npm run start -- --locale zh-cn
for starting Nacos's Chinese Simplified webpage in your local machine. -
Visit
localhost:3000/
-
npm run build
-
npm run serve
-
Visit
localhost:3000/
Base docusaurus v2.4.1
Node.js version 19.5.0
Please be noted that locale switching function doesn't work if you start the website in development mode using npm run start -- --locale zh-cn
or npm run start -- --locale en
. Please run it in production mode using the build-and-serve process to enable the locale switching function.
We use the Docusaurus internationalization (i18n) to support both English(en) and Chinese Simplified(zh-cn) Nacos Website. Besides, we apply Docusaurus Versioning to get versioned docs.
Our website stucture with i18n and versioning looks like below:
website
├── sidebars.json # sidebar for the current docs version
├── docs # docs directory for the current docs version
│ ├── foo
│ │ └── bar.md # https://mysite.com/docs/next/foo/bar
│ └── hello.md # https://mysite.com/docs/next/hello
├── versions.json # file to indicate what versions are available
├── versioned_docs
│ ├── version-1.1.0
│ │ ├── foo
│ │ │ └── bar.md # https://mysite.com/docs/foo/bar
│ │ └── hello.md
│ └── version-1.0.0
│ ├── foo
│ │ └── bar.md # https://mysite.com/docs/1.0.0/foo/bar
│ └── hello.md
├── versioned_sidebars
│ ├── version-1.1.0-sidebars.json
│ └── version-1.0.0-sidebars.json
├── blog
├── docusaurus.config.js
├── package.json
├── i18n
│ ├── en
│ │ ├── docusaurus-plugin-content-docs
│ │ │ ├── current
│ │ │ ├── version-1.0.0
│ │ │ └── version-1.1.0
│ │ ├── docusaurus-plugin-content-blog
│ │ └── ...
│ └── zh-cn
│ │ ├── docusaurus-plugin-content-docs
│ │ │ ├── current
│ │ │ ├── version-1.0.0
│ │ │ └── version-1.1.0
│ │ ├── docusaurus-plugin-content-blog
│ │ └── ...
docs - Contain the current (latest version) documents (placeholder for sidebar indexing purposes)
Document Content should be Placeholder. DO NOT DELETE.
sidebars.json - Set the sidebar for the current (latest version) documents.
versioned_docs - Contain the previous version documents (placeholder for sidebar indexing purposes)
Document Content should be Placeholder. DO NOT DELETE.
versioned_sidebars - Set the sidebar for the specific previous versions documents.
i18n-en
-docusaurus-plugin-content-docs-current
- Contain the actual latest version English documents.
i18n-en
-docusaurus-plugin-content-docs-version-1.0.0
- Contain the actual 1.0.0 version English documents.
i18n-zh-cn
-docusaurus-plugin-content-docs-current
- Contains the actual latest version Simplified Chinese documents.
i18n-zh-cn
-docusaurus-plugin-content-docs-version-1.0.0
- Contain the actual 1.0.0 version Simplified Chinese documents.
Steps to add a document for the latest version:
- Place placeholder document under the docs directory which is located in the root directory.
- Update sidebar.js, add a new entry to the path of this document.
- Place the English document under the i18-
en
-docusaurus-plugin-content-docs-current
directory. - Place the Chinese document under the i18-
zh-cn
-docusaurus-plugin-content-docs-current
directory.
Steps to add a document for a previous version:
- Place a placeholder document under the specific versioned_docs directory for the desired version which is located in the root directory.
- Update specific versioned_sidebars file, add a new entry to the path of this document.
- Place the English document under the i18-
en
-docusaurus-plugin-content-docs-specific version number
directory. - Place the Chinese document under the i18-
zh-cn
-docusaurus-plugin-content-docs-specific version number
directory.
Notes: Corresponding to Chinese file and English file of same contents, and the Chinese and English file names should be consistent.
We don't have a versioned blog, so it's easier to add a blog. When adding a new blog, it is automatically added in the Blog sidebar, where the order of blogs is sorted by the date
field in SEO in the blog file.
blog - Contain the blogs(placeholder for blog sidebar indexing purposes)
Blog Content should be Placeholder. DO NOT DELETE.
i18n-en
-docusaurus-plugin-content-blog - Contain all the actual English blogs.
i18n-zh-cn
-docusaurus-plugin-content-blog - Contain all the actual Simplified Chinese blogs.
Steps to add a blog:
- Place placeholder blog under the blog directory which is located in the root directory.
- Place the English blog under the i18-
en
-docusaurus-plugin-content-blog directory. - Place the Chinese blog under the i18-
zh-cn
-docusaurus-plugin-content-blog directory.
Notes: Corresponding to Chinese file and English file of same contents, and the Chinese and English file names should be consistent.
The type is :
---
title: title
keywords: [keywords1,keywords2]
description: some description
author: author name
date: 2018-12-29
custom_edit_url: https://github.com/nacos-group/nacos-group.github.io/blob/docusaurus/i18n/en/docusaurus-plugin-content-blog/download.md
---
Note:
title
can not include:
keywords
must be aArray
- Do not use un correct html tag like
<img>、<br>
, replace with<img /> <br />
- If you want show
<xx>
, replace with<xx>
- This is official Docusaurus docs :https://docusaurus.io/docs