xiaoyh 的个人博客

一个只会敲代码的咸鱼

0%

hexo 主题 —— nexT 配置

对于 hexo 最火的主题 nexT,它的配置在 nexT 目录下的 _config.xml 主题配置文件中

scheme

nexT 有 4种 scheme,分别为 Muse、Mist、Pisces、Gemini,默认为 Muse ,我个人认为 Gemini 最好看。若想切换 scheme 只需简单地修改注释即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
## 默认

# Schemes
scheme: Muse
#scheme: Mist
#scheme: Pisces
#scheme: Gemini


## 根据个人喜好修改

# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini

menu 即菜单,nexT 的默认菜单只有 home 与 archives,|| 后面的是对应菜单项的图标,若想增加更多菜单项取消注释即可。

1
2
3
4
5
6
7
8
9
menu:
home: / || fa fa-home
#about: /about/ || fa fa-user
# tags: /tags/ || fa fa-tags
# categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
#schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat

修改字体大小

nexT 的字体太大,若想修改需打开 themes\next\source\css\_variables\base.styl,找到里面的 Font size 部分

1
2
3
4
5
6
7
8
9
// Font size
$font-size-base = (hexo-config('font.enable') and hexo-config('font.global.size') is a 'unit') ? unit(hexo-config('font.global.size'), em) : 1em;
$font-size-smallest = .75em;
$font-size-smaller = .8125em;
$font-size-small = .875em;
$font-size-medium = 1em;
$font-size-large = 1.125em;
$font-size-larger = 1.25em;
$font-size-largest = 1.5em;

不同的 Font 字段控制博客不同的部分,其中 font-size-large 控制正文大小(包括标题)

1
2
// 修改
$font-size-large = 1em;

设置首页不显示全文

Next 首页默认是显示全文的,这样显然很不方便,因此需要一些方法去只显示前面一部分。
首先需要在Next主题的_config.yml中把设置打开:(默认安装时就打开了)

1
2
# Automatically excerpt description in homepage as preamble text.
excerpt_description: true

有两种方式显示摘要

截断

在文章需要截断的地方加上 <!--more-->,首页就只会显示其之上的内容。

写描述

在文章的 front-matter 中添加 description,其内容就会被显示在首页上,正文一律不显示。比较不方便的是还得写一下概述,很多时候会懒得写,因此不常用。

1
2
3
title: 让首页显示部分内容
date: 2020-02-23 22:55:10
description: 这是显示在首页的概述,正文内容均会被隐藏。