1.修改文件名称大小写

Hexo博客框架,修改tag或文件大小写,发布后发现大小写并未改变?

网上的解决方法:

1
2
3
修改.deploy_git.git目录下的config,

ignorecase = true 改为 false

我的工程下没有.deploy_git.git目录,但有.deploy_git目录,目录下有.git目录,还有本应在public下生成的博客目录。

按照以上方法修改config后,发现仍未解决,只有将.deploy_git目录下的除.git外的文件删除后方可


2.警告LF->CRLF

Hexo Git部署警告warning: LF will be replaced by CRLF的去除方法。

在windows下:

1
2
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in xxx.html.

这是因为Git将LF替换为CRLF,使用以下命令禁止此功能:

1
git config --global core.autocrlf false

3.butterfly主题添加备案信息

进入 Butterfly 主题目录,打开 layout/includes/footer.pug 文件,在末尾添加如下代码:

1
2
3
4
5
6
7
8
9
10
11
12
if theme.ICP.enable
.icp
a(href=theme.ICP.url)
if theme.ICP.icon
img.icp-icon(src=url_for(theme.ICP.icon))
span=theme.ICP.text
if theme.NSP.enable
.icp
a(href=theme.NSP.url)
if theme.NSP.icon
img.icp-icon(src=url_for(theme.NSP.icon))
span=theme.NSP.text

修改butterfly配置文件_config.yml,在footer setting下:

1
2
3
4
5
6
7
8
9
10
ICP:
enable: true # 是否启用ICP
url: http://www.beian.miit.gov.cn/ # 点击后的链接地址
text: 京ICP备xxxx # 备案号
icon: # 图标
NSP:
enable: true # 是否启用NSP
url: http://www.beian.gov.cn/ # 点击后的链接地址
text: 京公网安备 xxxxx号 # 公安备案号
icon: http://www.beian.gov.cn/img/new/gongan.png # 图标

4.Hexo增加搜索功能

1
2
3
4
5
6
7
8
9
10
11
1. 安装搜索:在Hexo根目录下执行命令:
npm install hexo-generator-searchdb --save

2. 配置Hexo的_config.yml文件,新增search:
search:
path: search.xml
field: post
format: html
limit: 10000

3. 在主题配置文件_config.yml中,修改local_search为true