Docusaurus2 can quickly build documents, blogs, official websites, and publish to GitHub Pages, Serverless, etc.

We just need Markdown to write the content, or we can write the React component directly to embed it. SEO, search, version and so on are friendly support.

Another important point is that the project is maintained open source by Facebook and they use it themselves, so the quality and long-term performance are guaranteed.

  • Code: github.com/ikuokuo/sta…
  • Presentation: ikuokuo. Making. IO/start – docus… 👀

The premise to prepare

  • Node. Js version > = 10.15.1
  • Yarn version > = 1.5
❯ node -v
v12.18.4

❯ yarn version
yarn version v1.22.10
Copy the code

Create a project

# npx @docusaurus/init@latest init [name] [template]
npx @docusaurus/init@latest init my-website classic
Copy the code

Run output:

Success! Created my-website
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn deploy
    Publish website to GitHub pages.

We suggest that you begin by typing:

  cd my-website
  yarn start

Happy hacking!
Copy the code

Run the application

cd my-website/
yarn start
Copy the code

Visit http://localhost:3000/start-docusaurus2/ local address.

Release toGitHub Pages

Modify docusaurus. Config. Js:

module.exports = {
  title: 'My Site'.tagline: 'The tagline of my site'.url: 'https://ikuokuo.github.io'.baseUrl: '/start-docusaurus2/'.onBrokenLinks: 'throw'.favicon: 'img/favicon.ico'.organizationName: 'ikuokuo'.projectName: 'start-docusaurus2'. };Copy the code

Release:

cd my-website/
GIT_USER=ikuokuo USE_SSH=true yarn deploy
Copy the code

Visit ikuokuo. Making. IO/start – docus… Online address.

Published to the Serverless

  • Ali cloud function calculation
  • Tencent cloud Serverless

GoCoding personal practice experience sharing, please pay attention to the public account!