搭建个人博客

工具:Cloudflare+GitHub+Hexo Fluid

Hexo

hexo 是一个快速、简洁,而且功能强大的静态博客框架。我们可以使用 Markdown 编写博客文章,然后 hexo 帮我们把 Markdown 文件渲染成静态 HTML 页面。因此 hexo 非常适合用来搭建技术类博客,以及项目文档和个人网站。

需要安装node.js依赖

github托管

将博客项目托管到github仓库,并使用Github pages来部署博客,可以让其他人也访问该博客。

Cloudflare

使用cloudflare加速国内用户访问速度。

1
https://dash.cloudflare.com/062413ad293e022e2f66f461b1a256f6/pages/view/jimi-lab-github-io

修改Hexo主题

我选择Fluid主题,再加一些个性化的设计,大家可以自行选择。

添加评论功能

使用github utterances插件

md中添加截图

cursor中使用了Paste Image插件。
F1截图之后,Ctrl+Alt+V,直接粘贴到特定目录,并在当前md文档中引用该图片。

使用

发布新文章

1.在Hexo项目根目录下使用命令:

1
hexo new "Hello World"

使用该命令会在文件中自动生成文件头。
2.这样会在 source/_posts/ 目录下自动生成一个 Hello-World.md 的新文章文件。你只需要编辑这个 Markdown 文件,写入你的内容即可。

将语雀文档同步到个人博客:

1.将语雀文章以md格式导出。
2.将导出的文件复制粘贴进Hello-World.md文件(直接将导出的文件拖入source/_posts/ 目录也可以)
3.运行:

1
R:\MyProject\MyBlog\my-blog>python yuque.py Hello-World.md

(这条命令会将Hello-World.md中的cdn链接转储到本地source/img/Hello-World目录下并在Hello-World.md更改引用本地图片)

运行以下命令可在本地查看编辑效果。

1
hexo server

3.完成内容创作之后,运行:

1
hexo clean && hexo generate && hexo deploy

该命令会将本地的仓库的内容同步到GitHub。


最终URL:
github:https://jimi-lab.github.io/
cloudflare:https://jimi-lab-github-io.pages.dev/

最终效果图如下:

报错信息汇总

1.如果遇到以下错误:

1
2
3
4
5
6
7
8
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (R:\MyProject\MyBlog\my-blog\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:524:28)
at cp.emit (R:\MyProject\MyBlog\my-blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)

可能是因为ssh连接github时候连接不上报错,可以尝试打开代理/电脑使用自己手机热点/等方法解决。


搭建个人博客
https://jimi-lab.github.io/2025/05/18/搭建个人博客/
作者
Jimi
发布于
2025年5月18日
许可协议