Hexo Next主题的一些优化

选择 Scheme

在主题_config.yml文件中修改scheme: Pisces的值。

菜单设置

在主题_config.yml文件中修改:

1
2
3
4
5
6
menu:
home: /
categories: /categories
archives: /archives
tags: /tags
about: /about

代码高亮

在网站_config.yml文件中,设置auto_detect: true

开启第三方评论

disqus注册一个账号,并且Set up disqus on a new site。这时需要Choose your unique Disqus URL,记下你填下的disqus_shortname,在网站_config.yml文件中添加:

1
disqus_shortname: your-disqus-shortname

如需取消某个页面的评论,在md文件的front-matter中增加[^7]:

1
comments: false

社交信息

网站_config.yml文件中添加:

1
2
3
4
5
6
7
since: 2016
social:
github: https://github.com/HanjieLuo
# twitter: https://twitter.com/your-user-name
# weibo: http://weibo.com/your-user-name
# douban: http://douban.com/people/your-user-name
# zhihu: http://www.zhihu.com/people/your-user-name

自定义字体

编辑主题的 source/css/_variables/custom.styl文件,新增变量:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$font-family-headings = Baskerville, Georgia, "Liberation Serif", "Kaiti SC", STKaiti, "AR PL UKai CN", "AR PL UKai HK", "AR PL UKai TW", "AR PL UKai TW MBE", "AR PL KaitiM GB", KaiTi, KaiTi_GB2312, "TW\-Kai", Lato, "PingFang SC", "Microsoft YaHei", sans-serif, "Times New Roman", serif; // 标题,修改成你期望的字体族

$font-family-base = askerville, Georgia, "Liberation Serif", "Kaiti SC", STKaiti, "AR PL UKai CN", "AR PL UKai HK", "AR PL UKai TW", "AR PL UKai TW MBE", "AR PL KaitiM GB", KaiTi, KaiTi_GB2312, "TW\-Kai", Lato, "PingFang SC", "Microsoft YaHei", sans-serif; // 修改成你期望的字体族

$code-font-family = "Input Mono", "PT Mono", Consolas, Monaco, Menlo, monospace // 代码字体

// Font size
$font-size-base = 16px // 正文字体的大小
$font-size-small = $font-size-base - 2px
$font-size-smaller = $font-size-base - 4px
$font-size-large = $font-size-base + 4px

// Headings font size
$font-size-headings-base = 28px
$font-size-headings-step = 2px

$code-font-size = 13px // 代码字体的大小

其他的可参看base.styl文件。

将侧边栏头像修改为圆形1

修改_sidebar.styl,增加两段程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.site-author-image {
display: block;
margin: 0 auto;
max-width: 96px;
height: auto;
padding: 2px;
border-width: 1px;
border-color: $gainsboro;

/* start*/
border-radius: 50%
webkit-transition: 1.4s all;
moz-transition: 1.4s all;
ms-transition: 1.4s all;
transition: 1.4s all;
/* end */
}


  1. http://fancyluo.com/2015/09/18/2015-09-18-hexo-next-update/↩︎