本地下载操作
- 包管理器下载hexo, brew install hexo,
- 切换到本地准备存储博客的文件夹,cd ~/azBlog
- 执行 $ hexo init blog ,$ cd blog
- $ hexo server ,这时候就弹出一个默认为http://localhost:4000/的地址,浏览器访问显示hexo页面
- 此时hexo初始化项目成功
homebrew包管理工具:https://brew.sh/
淘宝镜像过期,替换为官网仓库命令为:npm config set registry https://registry.npmjs.org/
hexo: https://github.com/hexojs/hexo
hexo操作文档:https://hexo.io/zh-cn/docs/configuration
了解Hexo操作
常用指令
全部命令:https://hexo.io/zh-cn/docs/commands
1 2 3 4 5 6 7 8 9 10 11 12 13
| hexo init [folder]
hexo new [layout] <title> 中的 default_layout 参数代替。如果标题包含空格的话,请使用引号括起来。
hexo generate == hexo g
hexo server == hexo s
hexo clean 在某些情况(尤其是更换主题后),如果发现您对站点的更改无论如何也不生效 您可能需要运行该命令 hexo deploy
|
部署GitHub
GitHub操作
- 创建一个空仓库
- 进入settings – pages : Custom domain可以设置自己的域名
hexo操作
- 安装 hexo-deployer-git
1
| npm install hexo-deployer-git --save
|
- 在_config.yml中添加以下配置
1 2 3 4
| deploy: type: git repo: https: branch: <yourbranch>
|
- 执行git
1 2 3 4 5 6 7 8 9 10 11
| git init
git remote add origin https:
git remote -v
git add .
git commit -m "Initial commit"
git push -u origin main
|
- 执行 hexo clean,执行 hexo deploy
- 浏览 <GitHub 用户名>.github.io/仓库地址检查你的网站能否运作。