Docusaurus2 可快速搭建文檔、博客、官網等網站,併發布到 GitHub Pages, Serverless 等。node
咱們只需 Markdown 寫寫內容就行,也可直接編寫 React 組件嵌入。而 SEO、搜索、版本等都友好支持了。git
另外重要的一點是此項目是 Facebook 開源維護的,他們本身也在用,因此質量、長久性能有所保證。github
❯ node -v v12.18.4 ❯ yarn version yarn version v1.22.10
# npx @docusaurus/init@latest init [name] [template] npx @docusaurus/init@latest init my-website classic
運行輸出:web
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!
cd my-website/ yarn start
訪問 http://localhost:3000/start-docusaurus2/ 本地地址。併發
修改 docusaurus.config.js
:app
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', ... };
發佈:less
cd my-website/ GIT_USER=ikuokuo USE_SSH=true yarn deploy
訪問 https://ikuokuo.github.io/start-docusaurus2/ 在線地址。ide
GoCoding 我的實踐的經驗分享,可關注公衆號!函數