Hexo搭建博客之Next主题精析

在上一节中,我们已经学会了使用hexo搭建博客,并且可以使用hexo发布博文。

在这一节中,将介绍一些基于Next主题配置的实用功能,有了这些功能,博客看起来会更美观和充实。

准备

配置Next主题

打开站点配置文件(这里要注意不是主题配置文件而是站点配置文件),将theme 后的主题改成你选择的主题,我的是Next。

正文

下面开始配置主题配置文件_config.yml

配置网站的图标

1
favicon: /blog/images/favicon.ico

在favicon 后填写图标的路径

添加悬赏功能

1
2
3
reward_comment: 您的支持将鼓励我继续创作,我一直在期待那个最帅的人出现!
wechatpay: /blog/images/wechat-image.png
alipay: /blog/images/alipay-image.png

配置主页显示的菜单

可以根据自己喜好进行配置。

1
2
3
4
5
6
7
8
menu:
home: /
categories: /categories
about: /about
archives: /archives
tags: /tags
#sitemap: /sitemap.xml
#commonweal: /404.html

配置博客的字体

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
37
font:
enable: true
# Uri of fonts host. E.g. //fonts.googleapis.com (Default)
host:
# Global font settings used on <body> element.
global:
# external: true will load this font family from host.
external: true
family: Lato
# Font settings for Headlines (h1, h2, h3, h4, h5, h6)
# Fallback to `global` font settings.
headings:
external: true
family:
# Font settings for posts
# Fallback to `global` font settings.
posts:
external: true
family:
# Font settings for Logo
# Fallback to `global` font settings.
# The `size` option use `px` as unit
logo:
external: true
family:
size:
# Font settings for <code> and code blocks.
codes:
external: true
family:
size:

配置代码高亮样式

1
2
3
# Available value:
# normal | night | night eighties | night blue | night bright
highlight_theme: night eighties

添加百度统计

注册并登陆百度统计。点击 管理->新增网站,添加自己网站的域名,

添加成功以后点击获取代码,这里有两种情况。常规方法:在管理–>获取代码->复制代码,复制到你的网站主页head标签内的script标签里。
在Next主题中已经帮我们完成了这个步骤,只需要将你的Baidu Analytics ID 复制到主题配置文件中即可。

1
2
# Baidu Analytics ID
baidu_analytics:

添加百度分享

1
2
3
4
5
6
# Baidu Share
# Available value:
# button | slide
# Warning: Baidu Share does not support https.
#baidushare:
#type: slide

这里可以配置百度分享,但要注意百度分享会覆盖掉多说分享,所以如果你想使用多说分享,一定要把这段话注释掉




下面开始配置站点配置文件_config.yml。

多说和多说热评配置

duoshuo_shortname为博客中显示的你的昵称。

1
2
3
4
5
# 多说share
duoshuo_shortname: leezp
duoshuo_share: true
# hot comments
duoshuo_hotartical: true

站点概览显示的栏目配置

1
2
3
4
5
6
# Menu configuration
menu:
home: /
archives: /archives
tags: /tags
categories: /categories

社交媒体配置

1
2
3
4
5
6
social:
GitHub: https://github.com/leezp
#Twitter: your-twitter-url
Weibo: your-weibo-url
DouBan: your-douban-url
ZhiHu: your-zhihu-url

总结

Hexo博客和Next主题可配置的地方还有很多,这里只是抛砖引玉。

版权声明:本文为博主原创文章,转载请注明出处 Leezp’s Blog

点击按钮打赏作者!