文件配置
hexo
扩展了markdown
的语法,添加了一些指令用于文件配置,称之为Front-matter
配置块格式
hexo
指定了YAML
(默认)和JSON
两种书写格式,示例如下:
-
YAML
title: Hello World date: 2013/7/13 20:46:25 ---
-
JSON
"title": "Hello World", "date": "2013/7/13 20:46:25" ;;;
指令解析
主要指令如下
Years | Version | Repository |
---|---|---|
Setting | Description | Default |
layout | Layout | config.default_layout |
title | Title | Filename (posts only) |
date | Published date | File created date |
updated | Updated date | File updated date |
comments | Enables comment feature for the post | true |
tags | Tags (Not available for pages) | |
categories | Categories (Not available for pages) | |
permalink | Overrides the default permalink of the post | |
excerpt | Page excerpt in plain text. Use this plugin to format the text | |
disableNunjucks | Disable rendering of Nunjucks tag {{ }}/{% %} and tag plugins when enabled |
许多插件还会加入新的指令,比如:sticky、abbrlink等等
类别&标签
类别和标签指令仅作用于文章
类别按顺序作用于帖子,形成类的层次结构;标签都在同一层级上定义,它们的顺序并不重要
示例如下:
categories:
- 学校
- 学生
tags:
- 好玩
- 有趣
- good
这篇文章属于学校类里面的学生类,共有3
个标签
一篇文章可能从属于多个类别,那么可以将每个列别结构用中括号括起来,比如
categories:
- [Sports, Baseball]
- [MLB, American League, Boston Red Sox]
- [MLB, American League, New York Yankees]
- Rivalries
这篇文章一共属于4
个类