@@ -21,7 +21,7 @@ updated: 2023-12-23 11:45:00
2121
2222链接:[ https://blog.davidingplus.cn ] ( https://blog.davidingplus.cn )
2323
24- ![ image-20231223105515106] ( https://image .davidingplus.cn/images/2025/02/01/image-20231223105515106.png )
24+ ![ image-20231223105515106] ( https://cdn .davidingplus.cn/images/2025/02/01/image-20231223105515106.png )
2525
2626<!-- more -->
2727
@@ -43,7 +43,7 @@ sudo apt install nodejs
4343
4444完成后使用如下命令,如果出现预期的效果代表安装成功:
4545
46- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20230929111248640.png " alt =" image-20230929111248640 " style =" zoom :67% ;" />
46+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20230929111248640.png " alt =" image-20230929111248640 " style =" zoom :67% ;" />
4747
4848# Hexo依赖环境:Git
4949
@@ -57,7 +57,7 @@ sudo apt install git
5757
5858安装完成之后同理可以查看版本检查是否安装成功。
5959
60- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20230929111644452.png " alt =" image-20230929111644452 " style =" zoom : 80% ;" />
60+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20230929111644452.png " alt =" image-20230929111644452 " style =" zoom : 80% ;" />
6161
6262至此,你可以进行后续的一系列` Git ` 操作了。
6363
@@ -82,7 +82,7 @@ npm install
8282
8383- 在这一步可能会出现一些问题,安装完成` hexo ` 框架之后可能系统会找不到` hexo ` 命令,例如:
8484
85- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20230929112334776.png " alt =" image-20230929112334776 " style =" zoom :80% ;" />
85+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20230929112334776.png " alt =" image-20230929112334776 " style =" zoom :80% ;" />
8686
8787 但是这个时候正常情况下我们的` hexo ` 框架是已经安装好了的,系统识别不到这个命令大概率是` hexo ` 没有被添加到环境变量里面,为了解决这个问题,我们在之后的` hexo ` 命令前面都加上` npx ` ,也就是:
8888
@@ -100,7 +100,7 @@ npm install
100100
101101 可以看出我这里有权限的问题,所以以后的执行最好我们还是加上` sudo ` 或者切换成为` root ` 用户(` sudo su ` ),为了方便,后续的命令当中我还是使用` hexo ` ,前面的修饰我就不加了
102102
103- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20230929112808923.png " alt =" image-20230929112808923 " style =" zoom :80% ;" />
103+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20230929112808923.png " alt =" image-20230929112808923 " style =" zoom :80% ;" />
104104
105105- ` hexo init ` 会去` GitHub ` 上` hexo ` 的开源项目里面上拉取对应的到本地
106106
@@ -114,7 +114,7 @@ npm install
114114
115115 克隆完成之后会得到类似于我的这一系列文件,当然我这里面多了一些文件,这是我自己添加的,有特别作用。
116116
117- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20230929113510909.png " alt =" image-20230929113510909 " style =" zoom :67% ;" />
117+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20230929113510909.png " alt =" image-20230929113510909 " style =" zoom :67% ;" />
118118
119119- ` npm install ` 会在当前目录下安装` hexo ` 的依赖包,在上面的图中是` node_modules ` 文件夹,** 注意一定要在博客文件的根目录安装**
120120
@@ -134,7 +134,7 @@ cnpm --version
134134
135135可能得到如下的结果,这样就安装成功了,以后都是用` cnpm ` 命令代替` npm ` 即可
136136
137- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203160959298.png " alt =" image-20231203160959298 " style =" zoom :80% ;" />
137+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203160959298.png " alt =" image-20231203160959298 " style =" zoom :80% ;" />
138138
139139# 更换博客主题
140140
@@ -144,7 +144,7 @@ cnpm --version
144144
145145例如,我选择的就是主题` stun ` ,点击可以进入对应的` GitHub ` 链接。
146146
147- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203161650101.png " alt =" image-20231203161650101 " style =" zoom : 50% ;" />
147+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203161650101.png " alt =" image-20231203161650101 " style =" zoom : 50% ;" />
148148
149149下面以我的主题为例,来安装并且替换掉默认的主题
150150
@@ -168,7 +168,7 @@ npm install hexo-renderer-pug --save
168168
169169这样以后,你会发现你的` theme ` 目录下多了` stun ` 的目录
170170
171- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203162105728.png " alt =" image-20231203162105728 " style =" zoom : 80% ;" />
171+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203162105728.png " alt =" image-20231203162105728 " style =" zoom : 80% ;" />
172172
173173然后打开项目根目录下的` _config.yml ` 文件,对主题参数进行修改
174174
@@ -193,13 +193,13 @@ npx hexo s # 启动本地服务器
193193
194194如果一切没有问题的话,终端应该会提示在` 4000 ` 端口开放了本地博客
195195
196- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203162517610.png " alt =" image-20231203162517610 " style =" zoom :67% ;" />
196+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203162517610.png " alt =" image-20231203162517610 " style =" zoom :67% ;" />
197197
198198- ` node_modules `
199199
200200 构建的过程中可能会报` node_modules ` 相关依赖的错误,例如
201201
202- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203162701520.png " alt =" image-20231203162701520 " style =" zoom :67% ;" />
202+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203162701520.png " alt =" image-20231203162701520 " style =" zoom :67% ;" />
203203
204204 这个时候我们根据建议运行命令安装依赖即可,必要时候加上` sudo `
205205
@@ -229,11 +229,11 @@ npx hexo s # 启动本地服务器
229229
230230登录账号后,点击页面右上角的` + ` ,选择新建仓库
231231
232- ![ image-20231203163853210] ( https://image .davidingplus.cn/images/2025/02/01/image-20231203163853210.png )
232+ ![ image-20231203163853210] ( https://cdn .davidingplus.cn/images/2025/02/01/image-20231203163853210.png )
233233
234234点击之后页面如下
235235
236- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203164027489.png " alt =" image-20231203164027489 " style =" zoom :50% ;" />
236+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203164027489.png " alt =" image-20231203164027489 " style =" zoom :50% ;" />
237237
238238- 仓库名称随意
239239- ** 路径** 这里建议填写` 你的用户名 ` ,这样生成出来的网页地址是比较纯净的形式,如` https://<你的用户名>.gitee.io ` 。当然也可以自定义名称,比如` blog ` ,但是这样后面生成出来的网页地址会带一个子目录,像` https://<你的用户名>.gitee.io/blog ` 这样
@@ -247,13 +247,13 @@ npx hexo s # 启动本地服务器
247247
248248然后点击页面右上角的服务,选择` Gitee Pages `
249249
250- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203164329313.png " alt =" image-20231203164329313 " style =" zoom :67% ;" />
250+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203164329313.png " alt =" image-20231203164329313 " style =" zoom :67% ;" />
251251
252252勾选` 强制使用HTTPS ` ,点击启动。
253253
254254- 这个的部署分支就是你博客构建出来的文件存放的分支,我的是` Site `
255255
256- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203164345096.png " alt =" image-20231203164345096 " style =" zoom : 67% ;" />
256+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203164345096.png " alt =" image-20231203164345096 " style =" zoom : 67% ;" />
257257
258258## 部署到远端
259259
@@ -263,7 +263,7 @@ npx hexo s # 启动本地服务器
263263
264264我们现在来看一下构建出来的文件在项目的哪里
265265
266- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231203164654321.png " alt =" image-20231203164654321 " style =" zoom : 80% ;" />
266+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231203164654321.png " alt =" image-20231203164654321 " style =" zoom : 80% ;" />
267267
268268这个` public ` 里面的文件就是构建出来的可以发布的成品,可以看到里面有一个主页面` index.html ` ,我们的` npx clean ` 其中删除的文件就有` public ` 目录
269269
@@ -279,11 +279,11 @@ npx hexo s # 启动本地服务器
279279
280280登录账号后,点击页面右上角的` + ` ,新建仓库
281281
282- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231223112125325.png " alt =" image-20231223112125325 " style =" zoom :75% ;" />
282+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231223112125325.png " alt =" image-20231223112125325 " style =" zoom :75% ;" />
283283
284284点击之后页面如下
285285
286- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231223112219108.png " alt =" image-20231223112219108 " style =" zoom : 67% ;" />
286+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231223112219108.png " alt =" image-20231223112219108 " style =" zoom : 67% ;" />
287287
288288- ` Repository name ` :` 你的名字.github.io ` ,比如我的就是` DavidingPlus.github.io `
289289- ` public ` :** 开源,开源,开源** !!!
@@ -293,11 +293,11 @@ npx hexo s # 启动本地服务器
293293
294294和` Gitee ` 不同的是,` GitHub ` 传上去会自己自动部署相关分支,所以很方便
295295
296- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231223112529840.png " alt =" image-20231223112529840 " style =" zoom :67% ;" />
296+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231223112529840.png " alt =" image-20231223112529840 " style =" zoom :67% ;" />
297297
298298记得开启强制` https `
299299
300- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231223114027133.png " alt =" image-20231223114027133 " style =" zoom :80% ;" />
300+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231223114027133.png " alt =" image-20231223114027133 " style =" zoom :80% ;" />
301301
302302## 部署到远端
303303
@@ -313,11 +313,11 @@ npx hexo s # 启动本地服务器
313313- ` message:git ` ` commit ` 的信息
314314- ` ignore_hidden ` :下面写清楚了这个是干啥的
315315
316- ![ image-20231223113355905] ( https://image .davidingplus.cn/images/2025/02/01/image-20231223113355905.png )
316+ ![ image-20231223113355905] ( https://cdn .davidingplus.cn/images/2025/02/01/image-20231223113355905.png )
317317
318318最后会在项目目录生成一个` .deploy_git ` 的目录,链接到你的仓库的部署分支,我的就是` master `
319319
320- <img src =" https://image .davidingplus.cn/images/2025/02/01/image-20231223113616332.png " alt =" image-20231223113616332 " style =" zoom :75% ;" />
320+ <img src =" https://cdn .davidingplus.cn/images/2025/02/01/image-20231223113616332.png " alt =" image-20231223113616332 " style =" zoom :75% ;" />
321321
322322完整的部署命令
323323
0 commit comments