Fork me on GitHub
KeKe Blog

Hexo主配置文件详解

主配置文件主要控制着一些标题、侧边栏和页面开头。
主要的一些样式我个人还是必将倾向于使用next主题,加上它的三个排版样式,让我有很过的选择空间,另外还能通过修改相关的样式,美化整体的页面等。

1 注意事项

  • 配置文件中,冒号(:)后面一定需要加空格
  • Hexo官方配置说明
  • 配置文件路径:hexo的目录下的config.yml文件

2 配置文件详解

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site 网站信息
# 标题
title: AllenKe Blog
# 头像
avatar: /images/avatar.jpg
# 副标题
subtitle: 技术学习文档汇总
# 网站描述
description: 不忘初心,方能终始
# 作者昵称
author: AllenKe
# 网站语言;默认英语
language: zh-Hans
# 时区;默认电脑时区
#timezone: Asia/Shanghai
timezone:
# URL 网址设置
## 如果网站是放在子目录中,将url设置成'http://yoursite.com/child',将root设置成'/child/'
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
# 网址
url: http://yoursite.com
# 网站根目录。如果网站是放在子目录中,将root设置城‘子目录’
root: /
# 文章链接地址格式。即文章的存放目录
permalink: :year/:month/:day/:title/
permalink_defaults:
# Directory 目录设置
# 资源文件夹:里面的文件会上传到Github
source_dir: source
# 公共文件夹:存放生成的静态文件
public_dir: public
# 标签文件夹:默认是tages;实际路径是source/tags
tag_dir: tags
rss_dir: rss
# 档案文件夹:默认是archives
archive_dir: archives
# 分类文件夹:默认是categories;实际存放在source/categories
category_dir: categories
# 代码文件夹:默认是downloads/code
code_dir: downloads/code
# 国际化文件夹:默认与language相同
i18n_dir: :lang
# 不需要渲染的文件夹或文件夹,放在[]中
# 这两个文件是百度和google的站长验证文件,不能渲染,否则会改变内容,不能验证过
skip_render:
# Writing 写作选项
# 新建博文的默认名称
# File name of new posts
new_post_name: :title.md
# 默认布局模版是post,而不是draft或page
default_layout: post
# 是否将标题转换成标题形式,首字母大写
titlecase: false # Transform title into titlecase
# 在新标签页面中打开网页
external_link: true # Open external links in new tab
filename_case: 0
# 食肉渲染草稿,默认是false,打开后可以阅览草稿
render_drafts: true
# 启动Asset文件夹
post_asset_folder: false
# 把链接改为与根目录的相对位置
relative_link: false
# 显示未来的文章
future: true
#代码块设置
highlight:
# 使用代码高亮
enable: true
# 显示行号
line_number: true
# 自动检查语言
auto_detect: false
tab_replace:
# Category & Tag 分类和标签
# 默认分类
default_category: uncategorized
# 分类别名
category_map:
# 标签别名
tag_map:
# Date / Time format 日期和时间格式
## Hexo uses Moment.js to parse and display date
## Hexo使用Moment.js 来解析和显示时间
## 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
# Pagination 分页设置
# ---------------下面选项需要对应插件的支持---------------
# npm install hexo-generator-index --save
# npm install hexo-generator-archive --save
# npm install hexo-generator-category --save
# npm install hexo-generator-tag --save
## Set per_page to 0 to disable pagination
# 设置每页显示的文章量
per_page: 10
# 首页的分页设置
#index_generator:
# per_page: 5
# 归档页的分页设置
#archive_generator:
# per_page: 30
# yearly: true
# monthly: true
# 标签页的分页设置
#tag_generator:
# per_page: 20
# 分页路径,在public 中可以查看
pagination_dir: page
# Extensions 拓展插件配置
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
# 选择主题,前提需将主题下载至hexo根目录下
# theme: landscape
theme: next
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repository: https://github.com/allenouyangke/allenouyangke.github.io.git
branch: master
# Duoshuo_system 多说评论系统调用
duoshuo_shortname: allenouyangke
# Content sharing services 分享系统
# JiaThis_share
jiathis: true
# Baidu_share
baidushare: true
# Duoshuo_share
duoshuo_share: true
# 配置RSS
#feed:
#feed 类型 (atom/rss2)
#type: atom
#rss 路径
#path: atom.xml
#在 rss 中最多生成的文章数(0显示所有)
#limit: 0
# Local Search
# 自定义站点内容搜索
# 需要先安装插件:
# npm install hexo-generator-search --save
search:
path: search.xml
# 只想设置所以文章可设置城post;默认是all;
field: post
-------------本文结束 感谢您的阅读-------------