我的博客传送门:https://xiehao.xyz/
hexo 博客搭建步骤详解:
1.先要在本地安装 node 和 git 环境,申请域名。
2.全局安装 hexo
npm install -g hexo
3.创建一个空目录:如我是 hexo, 再初始化 hexo
hexo init
4: 预览上传博客
hexo server --debug
// 打开 localhost:4000 访问预览
如果有恭喜你成功了。
5: 上传到github
5.1 在站点配置文件_config.yml中添加以下代码,仓库地址改为你的github仓库地址,用来连接你自己的 github 地址
deploy:
type: git
repository: [email protected]:xiechunhao/xiechunhao.github.io.git
branch: master
5.2 提交
hexo generate // 或者简写 hexo g
hexo deploy // 或者简写 hexo d
hexo clean // 清空缓存
6:github 创建一个博客的仓库,配置gitPage
6.1 申请一个自己的域名,阿里云可以去申请,设置自己的github 博客地址为映射的域名
6.2 打开仓库的 setting 配置 GitHub Pages 的 Custom domain 域名为你自己申请的域名, 如我的是:xiehao.xyz
然后 通过域名就可以访问到你自己的博客网站了,但是样式比较丑,我们可以去下载好看的主题并配置即可。