一篇带你使用 github pages + hexo 快速搭建个人博客

一篇带你使用 github pages + hexo 快速搭建个人博客
mu1. 创建一个名为 <账户名>.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
,检查网站能否运作手机上访问效果