安装 Hexo及配置环境

推荐官方文档 https://hexo.io/zh-cn/docs/

node.js 环境配置教程推荐阅读node.js安装及环境配置教程

部署 Hexo 到 GitHub Pages

本地博客测试成功后,就是上传到 GitHub 进行部署,使其能够在网络上访问。

创建 Github Pages 仓库

GitHub 主页右上角加号 -> New repository:

  • Repository name 中输入 用户名.github.io
  • 勾选 “Initialize this repository with a README”
  • Description 选填

填好后点击 Create repository 创建。

本地安装插件

首先 安装 hexo-deployer-git

1
npm install hexo-deployer-git --save

然后修改 _config.yml 文件末尾的 Deployment 部分,修改成如下:

1
2
3
4
deploy:
type: git
repository: git@github.com:用户名/用户名.github.io.git
branch: master

完成后运行 hexo d 将网站上传部署到 GitHub Pages。

完成!这时访问我们的 GitHub 域名 https://用户名.github.io 就可以看到 Hexo 网站了。

绑定域名(可选)

博客搭建完成使用的是 GitHub 的子域名(用户名.http://github.io),我们可以为 Hexo 博客绑定自己的域名替换 GitHub 域名,更加个性化和专业,也利于 SEO。

更改主题

官方主题市场

https://hexo.io/themes/

推荐主题

matery

https://gitee.com/yafine66/hexo-theme-matery

butterfly

https://butterfly.js.org/posts/21cfbf15/#%E5%AE%89%E8%A3%9D

美化教程https://blog.csdn.net/kuashijidexibao/article/details/112971657,中间有些模块似乎不可以用。

icarus

https://easyhexo.com/2-Theme-use-and-config/2-12-hexo-theme-icarus/