一、创建仓库并发布
1. 创建一个名为 <账户名>.github.io
的仓库

2. 新建 index.html
文件
内容为:
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>my blog</title>
</head>
<body>
<h1>this is my blog</h1>
<h1>Hello ~</h1>
</body>
</html>


3. 访问主页


4. 搭建 hexo
- 安装 hexo
npm install -g hexo-cli hexo init <project-name> cd <project-name> npm install
- 本地启动
控制台看到如下即启动成功hexo g && hexo s
访问 http://localhost:4000/
5. 将 hexo 发布到 github pages
- 安装
hexo-deployer-git
npm install hexo-deployer-git --save
- 在
_config.yml
中添加以下配置deploy: type: git repo: git@github.com:mmmying/mmmying.github.io.git branch: main
- 执行
hexo clean && hexo deploy
- 浏览
<username>.github.io
,检查网站能否运作手机上访问效果
二、修改主题
1. 安装主题
在 https://hexo.io/themes/ 选择一个喜欢的主题,比如 Claudia
在 hexo-blog 目录下执行
git clone https://github.com/Haojen/hexo-theme-Claudia.git themes/Claudia
2. 修改主题配置
修改 hexo-blog 目录下的 _config.yml
文件中的主题
// _config.yml
theme: Claudia
3.重新启动
hexo g
hexo s
