1.安装Node.js
Node.js是能够在服务器端运行JavaScript 的开放源代码、跨平台 JavaScript 运行环境。
查看node版本 node -v
查看npm包管理器版本 npm -v
2. npm安装Hexo
1 | $ npm install -g hexo-cli |
3. 使用Hexo搭建博客
1 | $ mkdir blog |
4.启动博客
1 | $ hexo s // 启动本地服务 localhost:4000 hexo默认创建了主题为hello world的文章 |
5. 部署到xxx.gitHub.io
github 新建仓库
Create new repository
仓库名与GitHub帐号名相同
repository name : username.github.io // 浏览器输入该地址可访问
在blog目录下安装git部署的插件
安装
hexo-deployer-git
1 | $ npm install hexo-deployer-git --save |
修改站点配置文件 /blog/_config.yml
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/username/username.github.io.git
branch: master
部署到远端
1 | $ git config --global user.email "you@example.com" |
更改站点配置文件 /blog/_config.yml
theme: next
重新生成部署
hexo clean
hexo g
hexo s
hexo d
添加评论系统
https://bluelzy.com/articles/use_valine_for_your_blog.html
参考
https://www.bilibili.com/video/BV1Yb411a7ty?from=search&seid=15921694224540162753