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 我的实践的经验分享,可关注公众号!函数