Hexo配置文件详解
在_config.yml文件中修改大部分的配置。点击 下载 Hexo配置文件中文注释版。
- 阅前说明:如果你安装了Hexo主题,那么大多数设置都将在主题配置文件_config.[theme].yml中进行操作,因为主题配置文件的优先级高于Hexo配置文件,因此下面关于Hexo配置文件的介绍大多可不必理会,我将会在最后介绍几个常用的Hexo配置文件的设置。
1、网站(Site)
1 2 3 4 5 6 7
| title: Hexo subtitle: '' description: '' keywords: author: John Doe language: en timezone: ''
|
2、网址(URL)
1 2 3 4 5 6
| url: http://example.com permalink: :year/:month/:day/:title/ permalink_defaults: pretty_urls: trailing_index: true trailing_html: true
|
3、目录(Directory)
1 2 3 4 5 6 7 8 9 10 11 12 13
| source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render:
|
4、文章(Writing)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| new_post_name: :title.md default_layout: post titlecase: false external_link: enable: true field: site exclude: '' filename_case: 0 render_drafts: false post_asset_folder: false relative_link: false future: true syntax_highlighter: highlight.js highlight: line_number: true auto_detect: false tab_replace: '' wrap: true hljs: false prismjs: preprocess: true line_number: true tab_replace: ''
|
5、首页设置(Home page setting)
1 2 3 4
| index_generator: path: '' per_page: 10 order_by: -date
|
6、分类&标签(Category & Tag)
1 2 3
| default_category: uncategorized category_map: tag_map:
|
1 2 3
| date_format: YYYY-MM-DD time_format: HH:mm:ss updated_option: 'mtime'
|
1 2
| per_page: 10 pagination_dir: page
|
10、包括或不包括目录和文件(Include/Exclude file)
1 2 3
| include: exclude: ignore:
|
11、扩展(Extensions)
12、部署(Deployment)
部署配置见 部署到GitHub Pages
1 2 3 4 5 6
| deploy: type: git repo: <repository url> branch: [branch] token: [token] message: [message]
|
常用Hexo配置
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
| language: zh-CN
permalink: :year/:month/:day/:title.html pretty_urls: trailing_index: false trailing_html: false
skip_render: - "_posts/test-post.md" - "_posts/*" - "_posts/**" - "*.js" - "scripts/*.js"
post_asset_folder: true
theme: redefine
deploy: type: git repo: <repository url> branch: [branch] token: [token] message: [message]
|