生成站点地图

1
2
3
npm install hexo-generator-sitemap --save

npm install hexo-generator-baidu-sitemap --save

统计字数

1
npm install hexo-wordcount --save

加密文章

1
2
3
4
npm install hexo-blog-encrypt

npm uninstall hexo-generator-index
npm install hexo-generator-indexed

修改_config.yml配置文件 wordcount enable字段为true

1
2
3
4
5
6
7
# wordcount (字數統計)
# see https://butterfly.js.org/posts/ceeb73f/#字數統計
wordcount:
enable: true
post_wordcount: true
min2read: true
total_wordcount: true

添加twikoo评论系统

https://twikoo.js.org/backend.html#netlify-%E9%83%A8%E7%BD%B2

升级后编译失败

hexo 从6.3版本升级到了7.0,执行 hexo g 时报错误 Error: Cannot find module 'hexo-util'

1
npm install hexo-util --save

接入algolia搜索

algolia,注册账号

创建数据库

配置

修改根目录下的 _config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
algolia:
appId: "" # Application ID
apiKey: "" # Search API Key
adminApiKey: "" # Admin API Key
chunkSize: 5000
indexName: "" # 数据库名
fields:
- content:strip:truncate,0,500
- excerpt:strip
- gallery
- permalink
- photos
- slug
- tags
- title

修改 _config.butterfly.yml

1
2
3
4
5
6
7
8
algolia_search:
enable: true
hits:
per_page: 10
labels:
input_placeholder: Search for Posts
hits_empty: "我们没有找到任何搜索结果: ${query}"
hits_stats: "找到${hits}条结果(用时${time} ms)"

生成索引

1
2
3
4
5
npm install hexo-algoliasearch --save

hexo clean
hexo g
hexo algolia