Hexo问题记录

Hexo常用命令

  • hexo new [layout] <title> 新建一篇文章
  • hexo clean 清除缓存文件 (db.json) 和已生成的静态文件 (public)
  • hexo generate 生成静态文件
  • hexo server 启动服务器
  • hexo deploy 部署网站
    更多指令

从typora编辑器发布到Hexo需要做那些事情?

  1. 添加头部
    • 更改名字
    • 更改时间
    • 更改标签
  2. 替换链接

hexo-next 主题 添加评论功能

hexo - Next 主题添加评论功能

Hexo-next 主题 配置版权

使用Hexo的next主题,配置POST文章文末的版权信息

Hexo 关闭文章评论

Hexo 关闭文章评论

hexo-next设置网站的图标Favicon

hexo设置网站的图标Favicon

Hexo-NexT 加载性能优化

Hexo-NexT 加载性能优化

Hexo 配置图片懒加载

图片懒加载

貌似看到没有效果

hexo 部署到 gitee

Hexo 部署到 Gitee

报错:Code 401: 未经授权的操作,请检查你的AppId和AppKey.

配置域名
记得在 Leancloud -> 设置 -> 安全中心 -> Web 安全域名 把你的域名加进去。

否则网页会出现 “valine 未经授权的操作,请检查你的AppId和AppKey.” 提示。

hexo g 编译报错

错误内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
F:\Blog\Blog>hexo g
INFO Start processing
ERROR Process failed: _posts/[0CTF 2016]piapiapia 1.md
YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 4, column 5:
date: 2021-10-01 22:32:05
^
at generateError (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:167:10)
at throwError (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:173:9)
at readBlockMapping (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:1073:9)
at composeNode (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:1359:12)
at readDocument (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:1519:3)
at loadDocuments (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:1575:5)
at Object.load (F:\Blog\Blog\node_modules\js-yaml\lib\js-yaml\loader.js:1596:19)
at parseYAML (F:\Blog\Blog\node_modules\hexo-front-matter\lib\front_matter.js:80:21)
at parse (F:\Blog\Blog\node_modules\hexo-front-matter\lib\front_matter.js:56:12)
at F:\Blog\Blog\node_modules\hexo\lib\plugins\processor\post.js:48:20
at tryCatcher (F:\Blog\Blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:514:35)
at Promise._settlePromise (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:643:18)
at PromiseArray._resolve (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:126:19)
at PromiseArray._promiseFulfilled (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:144:14)
at PromiseArray._iterate (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:114:31)
at PromiseArray.init [as _init] (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:78:10)
at Promise._settlePromise (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:571:21)
at Promise._settlePromise0 (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:643:18)
at PromiseArray._resolve (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:126:19)
at PromiseArray._promiseFulfilled (F:\Blog\Blog\node_modules\bluebird\js\release\promise_array.js:144:14)
at Promise._settlePromise (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:579:26)
at Promise._settlePromise0 (F:\Blog\Blog\node_modules\bluebird\js\release\promise.js:619:10)
INFO Files loaded in 953 ms
INFO 0 files generated in 1.77 s

报错原因

标题中出现[]

解决办法

使用 大写 【

hexo d 报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
The file will have its original line endings in your working directory
[master ec9d510] Site updated: 2021-10-10 21:48:37
2 files changed, 2 insertions(+), 2 deletions(-)
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

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> (F:\Blog\Blog\node_modules\hexo-util\lib\spawn.js:52:19)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (F:\Blog\Blog\node_modules\cross-spawn\lib\enoent.js:40:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

测试与github连接

ssh -T git@github.com

1
2
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection refused

解决办法

网络换成手机热点