配置
Hexo默认提供配置文件:_config.yml ,也支持指定为其他配置文件。
网站
1 2 3 4 5 6 7
| title: 网站标题 subtitle: 网站副标题 description: 网站描述 keywords: 网站关键字,支持多个 author: 网站作者 language: zh-CN timezone: ''
|
网址
1 2 3 4 5 6 7 8
| url: http://iiiota.github.io root: / permalink: :year/:month/:day/:title/ permalink_defaults: post: post pretty_urls: trailing_index: true trailing_html: true
|
搜索
需要安装插件:npm install hexo-generator-search --save
配置:
1 2 3
| search: path: search.xml field: post
|
目录
1 2 3 4 5 6 7 8
| source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render:
|
文章
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
| new_post_name: :year-:month-:day-: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: ''
search: path: search.xml field: post
permalink_pinyin: enable: true separator: '-'
|
首页设置
1 2 3 4 5
| index_generator: path: '' per_page: 10 order_by: -date pagination_dir:
|
分类&标签
1 2 3
| default_category: uncategorized category_map: tag_map:
|
案例:
1 2 3
| category_map: "yesterday's thoughts": yesterdays-thoughts "C++": c-plus-plus
|
日期&时间格式
Hexo使用 Monent.js 来解析和显示时间。
1 2 3
| date_format: YYYY-MM-DD time_format: HH:mm:ss updated_option: false
|
分页
1 2
| per_page: 10 pagination_dir: page
|
扩展
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| theme: hexo-theme-bamboo theme_config: deploy: meta_generator: true
ignore: feed: type: atom path: atom.xml limit: 20 hub: content: content_limit: 140 content_limit_delim: ' ' order_by: -date
|
文件包含/忽略
glob匹配。
1 2 3
| include: exclude: ignore:
|
代替配置文件
自定义配置文件的路径。
1 2
| hexo server --config custom.yml hexo server --config custom.yml,custom2.json
|
代替主题配置文件
Hexo主题项目有一个独立的配置文件:_config.yml,可以在博客项目根目录的 _config.yml 中进行配置。
theme_config
1 2 3 4 5 6
| theme: "MY_THEME" theme_config: bio: "XXX" foo: bar: "XXX"
|
_config.[theme].yml: 放于项目根目录下,并在_config.yml中引用。