前置准备
node 环境、github 账号、VPN
开始
- 安装
hexo-cli
npm install -g hexo-cli
- 生成
blog
hexo init blog
cd blog
npm install
- 部署
3.1 申请一个新的 git 仓库:
https://github.com/wuhongxing/wuhongxing.github.io
3.2 重写 _config.yml 中的 deploy 配置
deploy:
type: git
repo: https://github.com/wuhongxing/wuhongxing.github.io.git
branch: main
message: 初次提交
3.3 安装插件
npm install hexo-deployer-git --save
3.4 执行 yarn clean & yarn deploy 即可
然后就可以打开 wuhongxing.github.io 就可以看见我们的博客了。
开始写作
-
执行
yarn server,启动一个本地服务,打开页面后,保存更改的内容就能实时看到 -
创建新的文章或者页面,可以使用下面的命令,也可以手动
hexo new [layout] <title>
# ex
hexo new post 'test'
主题、插件
-
可以到
https://hexo.io/themes/上面挑一个自己喜欢的 -
安装主题
2.1 git clone 到 theme 文件夹中
2.2 安装依赖
npm install hexo-wordcount --save
npm install hexo-generator-json-content --save
npm install hexo-generator-feed --save
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
2.3 在 theme/pure/_config.yml 中开启
busuanzi:
enable: true # 不蒜子统计
postCount:
enable: true # 是否开启文章字数统计
wordcount: true # 文章字数统计
min2read: true
-
将
blog/_config.yml中的theme字段改为你刚才的主题名称 -
最后执行
yarn server就可以看到效果了