front-matter
The front-matter is the area at the top of the file separated by ---
, used to specify the variables of individual files. For more information, please refer to Hexo official document: #front-matter
Field | Meaning | Value Type | Default Value |
---|---|---|---|
layout | Layout template | String | - |
title | Page title | String | - |
seo_title | Page title | String | page.title |
short_title | Page title (displayed in the group list) | String | page.title |
date | Creation time | Date | File creation time |
updated | Update date | Date | File modification time |
link | External article URL | String | - |
music | Internal music controls | [Object] | - |
robots | robots | String | - |
keywords | Page keywords | String | - |
description | Page description, abstract | String | - |
cover | Whether to show the cover | Bool | true |
top_meta | Whether to display the meta information at the top of the article or page | Bool | true |
bottom_meta | Whether to display the meta information at the bottom of the article or page | Bool | true |
sidebar | Page sidebar | Bool, Array | theme.layout.*.sidebar |
body | Page body elements | Array | theme.layout.on_page.body |
mathjax | Whether to render formulas | Bool, String | false |
thumbnail | Thumbnail | String | false |
icons | icons | Array | [] |
pin | whether to top | Bool | false |
Fields unique to layout:post
:
| Field | Meaning | Value Type | Default Value |
| :----------------- | :------------ | :------------- |: ------ |
| author | Article author | [Object] | config.author |
| categories | Categories | String, Array |-|
| tags | Tags | String, Array |-|
| toc | Whether to generate a directory | Bool | true |
author
| Field | Meaning | Value Type | Default Value |
| :----------------- | :------------ | :------------- |: ------ |
| name | Author name | String | config.author |
| avatar | Avatar | String | config.avatar |
| url | Link | String | config.url |
music
| Field | Must | Value Type |
| :----------------- | :------------ | :--------------- - |
| server | yes | netease, tencent, kugou, xiami, baidu |
| type | yes | song, playlist, album, search, artist |
| id | yes | song id / playlist id / album id / search keyword |
Top article
Set the following values in front-matter:
front-matterpin: true
Article classification
Multiple categories have two relationships, one is hierarchy (equivalent to folders), and the other is juxtaposition (equivalent to tags).
Multi-level classification:
front-matter--- categories: [category A, category B] ---
or
front-matter--- categories: -Category A -Category B ---
Parallel classification
front-mattercategories: -[Category A] -[Category B]
Multi-level + parallel classification
front-mattercategories: -[Category A, Category B] -[Category C, Category D]
Article Summary
Insert <!-- more -->
in the article, the previous part is the abstract.
source code of an article--- title: xxx date: 2020-02-21 --- This is a summary <!-- more --> This is the text
Note: <!-- more -->
There must be blank lines before and after <!-- more -->
Set article author
With support for multi-author jointly maintain a blog, so you can set up a separate authors:
front-matter--- author: name: Author avatar: https://img.vim-cn.com/a1/d53c11fb5d4fd69529bc805d385fe818feb3f6.png url: https://baidu.com ---
Import external articles
Using link
, with customized article author information, you can display external articles or URLs in the article list, for example:
front-matter--- layout: post date: 2017-07-05 title: [转] How to build an independent blog based on Hexo categories: [Dev, Hexo] tags: -Hexo author: name: xaoxuu avatar: https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/avatar/avatar.png url: https://xaoxuu.com link: https://xaoxuu.com/blog/2017-07-05-hexo-blog/ --- 
Top
For any article or page, set pin: true
to put it on the top page.
front-matter--- pin: true ---
This will cause a small problem: the number of post cards on the homepage is more than the set value. If you have obsessive-compulsive disorder and want the number of each page to be the same, you can install a plug-in to achieve it, see: [#421](https://github.com/ volantis-x/hexo-theme-volantis/issues/421)
Do not archive
Articles stored in the _posts
folder will generally appear on the archive page. If a post does not want to appear on the archive page:
front-matter--- archive: false ---