Hexo-next 主题的配置文件位于/themes/next/_config.yml,
大部分情况下只需要修改这个文件即可。
修改网站图标
1 2 3 4 5
| favicon: small: /images/favicon-16x16-next.png medium: /images/favicon-32x32-next.png apple_touch_icon: /images/apple-touch-icon-next.png safari_pinned_tab: /images/logo.svg
|
将你想要更改的图标文件放在/source/目录(推荐)或者hexo-site/themes/next/source/images/目录替换同名文件即可。
增加(或删除)“标签”、“分类”等
在网站所在文件夹执行
即可添加标签页面
(分类同理hexo new page categories)
对应 next 主题配置文件
1 2 3 4 5 6 7 8 9
| menu: home: / || home tags: /tags/ || tags categories: /categories/ || th archives: /archives/ || archive
|
添加友链
1 2 3 4 5 6 7
| links_icon: link links_title: Friends links_layout: block
links: 沚水的小窝: http://blog.zsakvo.cc/
|
设置自己头像
1
| avatar: /images/avatar.jpg
|
侧边栏增加自己社交账号
1 2 3 4 5 6 7 8 9 10 11
| social: GitHub: https://github.com/zsgdyf || github Twitter: https://twitter.com/zsgdyf || twitter
|
文章字数统计
安装字数统计插件
1
| npm i --save hexo-wordcount
|
然后打开主题配置
1 2 3 4 5 6
| post_wordcount: item_text: true wordcount: true min2read: false totalcount: true separated_meta: true
|
打开 post.swig 文件,/themes/next/layout/_macro/post.swig
找到如下代码:
1 2 3
| <span title="{{ __('post.wordcount') }}"> {{ wordcount(post.content) }} </span>
|
修改为:
1 2 3
| <span title="{{ __('post.wordcount') }}"> {{ wordcount(post.content) }} 字 </span>
|
同理修改阅读时长,修改为:
1 2 3
| <span title="{{ __('post.min2read') }}"> {{ min2read(post.content) }} 分钟 </span>
|
修改字体大小
找到 base.styl 文件,/themes/next/source/css/_variables/base.styl
找到如下代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| $font-size-base = 16px $font-size-base = unit(hexo-config('font.global.size'), px) if hexo-config('font.global.size') is a 'unit' $font-size-small = $font-size-base - 2px $font-size-smaller = $font-size-base - 4px $font-size-large = $font-size-base + 2px $font-size-larger = $font-size-base + 4px
$font-size-headings-step = 2px $font-size-headings-base = 25px $font-size-headings-base = unit(hexo-config('font.headings.size'), px) if hexo-config('font.headings.size') is a 'unit' $font-size-headings-small = $font-size-headings-base - $font-size-headings-step $font-size-headings-smaller = $font-size-headings-small - $font-size-headings-step $font-size-headings-large = $font-size-headings-base + $font-size-headings-step $font-size-headings-larger = $font-size-headings-large + $font-size-headings-step
|
修改其中的font-size-base即可。
增加站内搜索
在网站所在文件夹执行
1
| npm install hexo-generator-search
|
添加搜索功能
接着修改主题配置文件为
1 2
| local_search: enable: true
|