使用hexo和github搭建静态博客
概述
使用hexo搭建静态博客并部署到GitHub上
安装hexo
准备工作
- 下载git
- 安装nodejs
本地步骤
创建一个文件夹(这里称作blog)
回到上一级目录:
安装Hexo
1
npm install -g hexo-cli
进入blog
执行
1
2
3hexo init
npm install
npm install --save hexo-depolyer-git配置
_config.yml1
2
3
4deploy:
type: 'git'
repository: https://github.com/<github用户名>/<github用户名>.github.io.git
branch: gh-pages
GitHub步骤
- 创建仓库
<github用户名>.github.io,设为公共仓库 - 将blog文件夹push到仓库
- 在本地执行
hexo g - 在仓库的
settings-Pages将branch设为gh-pages
本地执行hexo d
安装fluid主题
fluid是在GitHub上开源的一款主题
在博客文件夹执行
1 | |
然后在博客目录下创建 _config.fluid.yml,将主题的 _config.yml 内容复制进去。
解决md插入图片
使用Typora作为markdown编辑器
typora在偏好设置中将图片路径设置为
./${filename}/安装
hexo-rederer-marked1
npm install hexo-renderer-marked更改
_config.yml1
post_asset_folder: true安装插件
hexo-image-link1
npm install hexo-image-link --save
解决标题特殊字符
将标题用' '围起来即可。
使用hexo和github搭建静态博客
https://www.kingdeworld.top/pages/2023/使用hexo和github搭建静态博客