Hexo 博客配置备份笔记

Hexo 博客配置备份笔记

发表于2018-07-16|分类于||阅读次数:
本文字数:1.4k|阅读时长 ≈3 分钟

前言

最近博客从WordPress迁移到Hexo,Hexo的配置很多,每次都得去对照next主题的官方文档去配置,很耗时间。为了避免重复造轮子,所以这里我就把已经配置好配置文件参数贴上,这样在下次配置的时候就不会再那么耗时间了。

安装 Hexo

1
2
3
4
5

npm install hexo-cli -g
cd/blog
hexo init

安装 next 主题

1
2
3

git clone https://github.com/theme-next/hexo-theme-next themes/next

博客设置

首先对博客基本信息做一些设置,配置文件在根目录下的_config.yml

设置语言

1
2
3

language:zh-CN

固定链接

1
2
3

permalink::year/:month/:day/:url

启用next主题

1
2
3

theme: next

设置主题的Scheme

Next有几种外观,

文章字数统计

安装:
$ npm install hexo-symbols-count-time --save

具体配置方法在这里

hexo配置:

1
2
3
4
5
6
7

symbols_count_time:
symbols:true
time:true
total_symbols:true
total_time:true

next主题配置:

1
2
3
4
5
6
7
8

symbols_count_time:
separated_meta:true
item_text_post:true
item_text_total:false
awl:2
wpm:275

修改文章内链接的样式

文章里的链接样式默认是只加一条下划线,颜色和普通文字一样,为了方便区分,在themes/next/source/css/_custom/custom.styl文件加以下代码,自行添加的样式都可以写在这个文件里:

1
2
3
4
5
6
7
8
9
10
11
12

.post-bodypa{
color: #0593d3;
border-bottom: none;
border-bottom: 1px solid #0593d3;
&:hover {
color: #fc6423;
border-bottom: none;
border-bottom: 1px solid #fc6423;
}
}

挑选你喜欢的样式,修改成你的GitHub链接,复制到themes/next/layout/_layout.swig文件中(放在``的下面),并把href改为你的github地址

修改文章底部的那个带#号的标签

具体实现方法
修改模板/themes/next/layout/_macro/post.swig,搜索 rel="tag">#,将#换成``