Build a Docusaurus site for production
build folder.npm run buildwebsite·Indexed 30 days ago
https://nightmachinery.github.io/dblog/Tutorials and guides for Docusaurus, a static-site-generator (Jamstack) used for creating documentation sites. Covers basic setup, creating documents, pages, and blog posts, utilizing Markdown features, managing documentation versions, i18n translation, and site deployment.
build folder.npm run buildTo create a standalone page, add a Markdown (.md) or React (.js) file to the src/pages directory. The file path determines the URL route:
src/pages/index.js maps to the root: localhost:3000/src/pages/foo.md maps to localhost:3000/foosrc/pages/foo/bar.js maps to localhost:3000/foo/barUse the Docusaurus CLI to snapshot the current state of your docs folder into a versioned release. This process copies the docs folder into a new directory under versioned_docs/ and creates a versions.json file to track the versions.
After creating a version (e.g., 1.0):
/docs/ (e.g., http://localhost:3000/docs/).docs folder) is available at /docs/next/ (e.g., http://localhost:3000/docs/next/).npm run docusaurus docs:version 1.0:::) to create styled admonitions and callouts, such as tips and danger warnings.:::tip My tip
Use this awesome feature option
:::
:::danger Take care
This action is dangerous
:::To create a standalone page, add a Markdown (.md) or React (.js, .jsx, .tsx) file to the src/pages directory. The file system routing automatically maps the file path to the URL path:
src/pages/index.js maps to /src/pages/foo.md maps to /foosrc/pages/foo/bar.js maps to /foo/bardocs/intro.md) will be reflected automatically in the browser.cd my-website
npm run startbuild folder locally. This serves the production build at http://localhost:3000/ to ensure everything functions correctly.npm run servenpm init docusaurus@latest my-website classicbuild folder.npm run buildblog/ directory. The file should include a front matter block containing the slug (which determines the URL), the title of the post, an optional list of authors with their details, and optional tags. Docusaurus automatically generates a dedicated page for the post, updates the blog index page, and manages the tag system and RSS feed.---
slug: greetings
title: Greetings!
authors:
- name: Joel Marcey
title: Co-creator of Docusaurus 1
url: https://github.com/JoelMarcey
image_url: https://github.com/JoelMarcey.png
- name: Sébastien Lorber
title: Docusaurus maintainer
url: https://sebastienlorber.com
image_url: https://github.com/slorber.png
tags: [greetings]
---
Congratulations, you have made your first post!
Feel free to play around and edit this post as much you like.docs/intro.md) will be reflected automatically in the browser.cd my-website
npm run startDocusaurus separates content by version using different directories. To update a specific version, edit the file within its corresponding versioned folder:
versioned_docs/version-X.X/ (e.g., versioned_docs/version-1.0/hello.md updates http://localhost:3000/docs/hello).docs/ folder (e.g., docs/hello.md updates http://localhost:3000/docs/next/hello).