每次总会有刚使用这个主题的小伙伴问很多问题,专门写这个 Hexo主题Sakura使用问题大全 记录在使用sakura主题过程中遇到的所有问题。这个文章会持续更新,也欢迎大家留言你们遇到的问题或者解决方法。

问题列表

按时间由新到旧排列

如何添加分类和标签

先在主题下的_config.yml添加分类这里以 自定义 为例

pic1938fee.png

然后在主题的languages下的zh-cn.yml 添加 如下所示配置

pic203413d.png

最后在写博客时添加这个分类,如果这个分类下没有文章点击就会404

pic21398f9.png

标签和这个分类操作基本一致

搜索功能无法使用

在博客根目录下执行以下代码

npm install hexo-generator-json-content --save

hexo s指令报错

很久没有用Hexo Sakura主题,更新了一下Nodejs和Hexo版本,结果就报下面的错误:

ERROR Process failed: client/index.md
TypeError [ERR_INVALID_URL]: Invalid URL: http://
    at onParseError (internal/url.js:257:9)
    at new URL (internal/url.js:333:5)
    at new URL (internal/url.js:330:22)
    at C:\Users\73778\Desktop\hexo (1)\node_modules\hexo-util\lib\full_url_for.js:22:18
    at Cache.apply (C:\Users\73778\Desktop\hexo (1)\node_modules\hexo-util\lib\cache.js:27:46)
    at Hexo.fullUrlForHelper (C:\Users\73778\Desktop\hexo (1)\node_modules\hexo-util\lib\full_url_for.js:18:16)
    at Hexo.module.exports (C:\Users\73778\Desktop\hexo (1)\node_modules\hexo\lib\plugins\helper\full_url_for.js:5:23)
    at _Document.<anonymous> (C:\Users\73778\Desktop\hexo (1)\node_modules\hexo\lib\models\page.js:36:25)
...

整了很久也没找到原因,后来发现是node_modules 这个里面的文件有问题,具体应该是新版有些东西会有BUG,用以前的node_modules 文件就好了,下面会给出node_modules.zip,删除博客根目录里面的node_modules ,把我的这个文件解压以后放进去就好了。

Sakura 新手手册

更多自定义sakura主题见【Hexo Sakura使用教程