在完整的搭建了hexo博客之后,基本功能都可以使用,这时可以添加一些自定义的插件,丰富自己的博客
主题 - next
下载主题
目前用的hexo版本是
5.3.0,目前next主题5.0+,7.0+和8.0+版本的地址分别为不同的地址,这里选用 7.8.0 release 稳定版本注:不同的hexo版本和next版本可能存在兼容性稳定,目前用的
hexo 5.3.0和next 7.8.0版本可以正常运行1
https://github.com/theme-next/hexo-theme-next/releases
配置主题
将上面下载的zip包解压至 hexo 博客目录下的
themes/下将文件夹重命名
next-7.8.01
2├── themes # 主题
| └── next-7.8.0 # next主题博客的配置文件
_config.yml修改主题为next-7.8.01
2
3
4# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next-7.8.0
评论插件 - Valine
获取APP ID 和 APP KEY
需要先登录或注册
LeanCloud, 进入控制台后点击左下角创建应用,这个时候会生成app id和app key主题添加评论插件
因为next主题直接集成了
Valine插件,所以只需要配置自己的app id和app key即可注:这里更改配置的地方为 next 主题内的
_config.yml1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18# Valine
# For more information: https://valine.js.org, https://github.com/xCss/Valine
valine:
enable: true
appid: # Your leancloud application appid
appkey: # Your leancloud application appkey
notify: false # Mail notifier
verify: false # Verification code
placeholder: Just go go # Comment box placeholder
avatar: mm # Gravatar style
guest_info: nick,mail,link # Custom comment header
pageSize: 10 # Pagination size
language: # Language, available values: en, zh-cn
visitor: false # Article reading statistic
comment_count: true # If false, comment count will only be displayed in post page, not in home page
recordIP: false # Whether to record the commenter IP
serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
#post_meta_order: 0
统计插件 - leancloud_visitors
获取APP ID 和 APP KEY
需要先登录或注册
LeanCloud, 进入控制台后点击左下角创建应用,这个时候会生成app id和app key配置
同样因为next主题集成了相关的插件,这里只需要将
app id和app key添加到配置文件即可注:这里更改配置的地方为 next 主题内的
_config.yml1
2
3
4
5
6
7
8
9
10
11
12
13
14# Show number of visitors of each article.
# You can visit https://leancloud.cn to get AppID and AppKey.
# AppID and AppKey are recommended to be the same as valine's for counter compatibility.
# Do not enable both `valine.visitor` and `leancloud_visitors`.
leancloud_visitors:
enable: true
appid: # Your leancloud application appid
appkey: # Your leancloud application appkey
# Required for apps from CN region
server_url: # <your server url>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
# If you don't care about security in leancloud counter and just want to use it directly
# (without hexo-leancloud-counter-security plugin), set `security` to `false`.
security: true
遇到的问题
现象:配置了next主题,无法显示
categoriestags等选择栏解决:手动创建页面,并配置好
index.md1
hexo new page "tags"
配置
tags的index.md1
2
3
4
5
6---
title: tags
date: 2020-12-19 22:38:35
type: tags
layout: tags
---1
hexo new page "categories"
配置
categories的index.md1
2
3
4
5
6---
title: categories
date: 2020-12-19 22:32:35
type: categories
layout: categories
---现象:文章侧边栏目录点击无效(包含中文的目录)
报错:
1
2utils.js:240 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
at HTMLAnchorElement.<anonymous> (utils.js:240)解决:目前有提到这个issue,有提到
7.9.0版本解决1
https://github.com/theme-next/hexo-theme-next/issues/1537
看到当时的报错是
utils.js,可以直接从github上拉取最新的utils.js即可解决1
https://github.com/theme-next/hexo-theme-next/blob/master/source/js/utils.js






















