0%

博客_config.yml文件的配置

前言

首先,我要在此恭喜一下自己,在大半年的不懈努力学习下,建站成功顺便学了一手html5。估计投入了约有40h的精力,但是由于操作失误导致其中的25h都是失败操作,意义不大。

为了防止大家出现无意义浪费时间的情况,我推了这则文章来简写一下博客根目录下_config.yml文件的配置。

请注意:本博客内容将默认您已经成功安装hexo环境并且配置好了landscape默认主题。

根据提示,我们成功安装了hexo并关联好了博客文件夹,在根目录下打开_config.yml文件,就可以看见博客信息的相关配置了。

基础信息配置:

1
2
3
4
5
6
7
8
# Site
title: 【网页标题】
subtitle: 【网页副标题】
description: 【描述,可以是格言】
keywords: 【关键字,便于搜索引擎爬取】
author: 【作者名,就是您】
language: 【主语言,简体中文是'zh-CN'】
timezone: 【时区,不写即默认所在地】

我配置完是这样的:

1
2
3
4
5
6
7
8
# Site
title: first's blog
subtitle: ''
description: Just Do It,But Not Just Do It.
keywords:
author: first_fan
language: zh-CN
timezone: ''

作用部位在图中指出[指向’首页’是指’home’变成了中文的’首页’]

网址链接配置

1
2
3
4
5
6
7
8
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://firstfan119.github.io 【此处改为自己的域名】
root: /
permalink: :year/:month/:day/:title/ 【永久链接日期格式,非必要可以不改】
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing index.html from permalinks

写作配置

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
# Writing
new_post_name: :title.md 【新稿件的默认名】
default_layout: post
titlecase: false # Transform title into titlecase
external_link: 【点击文章时在新标签页内打开】
enable: true 【如果想在本标签页内打开请关闭】
field: site 【对整页有用】
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight: 【代码高光】
enable: true 【是否开启】
line_number: true 【行号显示】
auto_detect: false 【自动检测】
tab_replace: '' 【替换tab】

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
path: ''
per_page: 10
order_by: -date

此处可以根据自己需要更改写作风格,我并未作大幅修改。

主题配置

1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next 【我使用的是next主题】

如果你下载了其他主题并已经将其放入themes文件夹中,则可以进行博客主题的选择,只要将名字更换为新主题名即可。

其他细节配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Category & Tag
default_category: uncategorized 【默认分类:未分类】
category_map:
tag_map: 【分类/标签地图,必要性不大】

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD 【日期格式设置,年月日是标准格式】
time_format: HH:mm:ss 【时分秒】
## Use post's date for updated date unless set in front-matter
use_date_for_updated: false

这里是对于分类,标签的默认值配置以及对于时间格式的配置。