Hexo配置

为了更全面的了解Hexo,特地从官网把文档扒下,再加上自己的理解翻译成中文,供大家学习交流。

原文出处: http://hexo.io/docs/configuration.html

Site 配置

主要配置网站的标题、作者、网站描述等等,具体参数如下:

参数 说明
title 网站标题
subtitle 网站副标题
description 网站描述
author 作者姓名
email 邮箱
language 网站使用语言(中文: zh-CN),其他设置详见IETF Format

URL 配置

主要配置网站的URL地址以及相关的目录路径

参数 说明 默认值
url 网站的URL
root 网站的根路径 /
permalink 文章的静态链接格式 :year/:month/:day/:title/
tag_dir 标签目录 tags
archive_dir 归档目录 archives
category_dir 分类目录 categories
code_dir 引用代码目录 downloads/code

注意: 如果你的博客在网站的子目录下,例如:http://yoursite.com/blog. 则将 url 设为 http://yoursite.com/blog 并把 root 设为 /blog/

Writing 配置

创建文章和生成静态页面的相关设置

参数 说明 默认值
new_post_name 新文章的文件名 :title.md
default_layout 默认的布局 post
auto_spacing 自动在单词间添加空格 false
titlecase 首字母大写 false
external_link 在新窗口打开外部链接 true
max_open_file 同步IO生成文件时的最大数量 100
multi_thread 开启多线程 true
filename_case 文件名大小写.1:小写 2:大写 0
render_drafts 在本地服务器上将草稿作为文章发布 false
highlight 代码块高亮设置

Category & Tag 配置

参数 说明 默认值
default_category 默认分类 uncategorized
category_map 分类映射(原文 Category slugs,英语水平较弱,只能按参数名进行翻译…)
tag_map 标签映射(原文 tag slugs,英语水平较弱,只能按参数名进行翻译…)

Archives 配置

参数 说明 默认值
archive 2:启用分页 1:禁用分页 0:完全禁用 2
category 2:启用分页 1:禁用分页 0:完全禁用 2
tag 2:启用分页 1:禁用分页 0:完全禁用 2

Server 配置

本地服务器配置参数

参数 说明 默认值
port 端口号 4000
logger 在控制台显示请求信息。debug模式下强制开启 false
logger_format 日志格式化
server_ip 绑定ip 0.0.0.0

Date / Time format 配置

hexo使用Moment.js来解析和格式化日期

参数 说明 默认值
date_format 日期格式化 MMM D YYYY
time_format 时间格式化 H:mm:ss

Pagination 配置

参数 说明 默认值
per_page 每页文章数 10
pagination_dir 分页目录 page

Comment 配置

参数 说明 默认值
disqus_shortname Disqus(社会化评论系统) 昵称

Extensions 配置

参数 说明
theme 使用主题
exclude_generator 禁用生成器
markdown Markdown 设置
stylus stylu 设置