Docs contributing guide
Thank you for your support of Layotto!
This document describes how to modify/add documents.The documents in this repository are written using Markdown syntax.
1. Document Path Description
Documents are uniformly placed in the docs/ directory, with docs/docs storing documents, docs/blog storing blogs, and docs/i18n storing translated multilingual documents.
2. Documentation Site Description
Files under the docs/ directory will be automatically deployed to github pages and rendered through docusaurus.
Generally speaking, after the .md file is merged into the main branch, you will be able to see the new page on the Layotto documentation site, and the deployment and rendering processes are automatic.
Local startup documentation site
After writing the document locally, in order to quickly preview the effect, you can also refer to docusaurus_installation to start the documentation site locally.
Here is a summary of the steps:
step 1. Install Docusaurus, make sure the Node.js version is 18.0 or above
npm install
step 2. Compile, compile the documents under 'docs' into static HTML files, and place the compiled files under 'docs/build'
npm run build --config docs
Step 3. Start the documentation site
# Run npm run serve --config docs in the layotto project root directory
npm run serve --config docs
step 3. Open http://localhost:3000/ to view the documentation site.
3. What needs to be done to add a document
step 1. Create a markdown document
When you need to add a new document, you can create a new folder according to the directory structure, and create a .md file.For example, if you want to write the design document for distributed lock API, create directories under both Chinese and English directories:
You can use Crowdin for auxiliary translation. After writing the Chinese documentation, use npm run crowdin:upload to upload the Chinese documentation to the Crowdin platform. Find the Layotto project on the platform, translate it, and download it to the local response directory.crowdin reference documentation
step 2. Add the document to the sidebar
After adding new documents and finishing the content, remember to update the sidebar.
The Chinese sidebar is in docs/sidebars.js
The English sidebar needs to perform the following:
npm run write-translations -- --locale en-US
Then modify the corresponding sidebar content in docs/i18n/en-US/docusaurus-plugin-content-docs/current.json