This article is translated from ChatGPT.
📚 Table of Contents
🚀 Get Started - 📑 Theme Pages - 📌 Theme Configuration - ⚔️ Tag Plugins - ❓ Q&A - ⚡️ Advanced Tutorials
Front-matter
Front-matter
is the section at the top of a Markdown file, separated by ---
, and is used to specify variables for individual files.
- Page Front-matter is used for configuring a
page
. - Post Front-matter is used for configuring a
post
.
If a parameter is marked as optional
, you can add it based on your needs, and it is not necessary to include all parameters in the Markdown file.
Page Front-matter
1 | --- |
Syntax | Explanation |
---|---|
title | [Required] Page title |
date | [Required] Page creation date |
type | [Required] Used for tags, categories, and friends links pages |
updated | [Optional] Page update date |
description | [Optional] Page description |
comments | [Optional] Display page comment module (default true) |
top_img | [Optional] Page top image |
mathjax | [Optional] Display MathJax (only needed when setting per_page: false for MathJax, default false) |
katex | [Optional] Display KaTeX (only needed when setting per_page: false for KaTeX, default false) |
aside | [Optional] Display sidebar (default true) |
aplayer | [Optional] Load aplayer's js and css on the specified page, please refer to the music configuration below the article |
highlight_shrink | [Optional] Configure whether code blocks are expanded (true/false) (default is the setting of highlight_shrink ) |
random | [Optional] Configure whether to randomly sort friends links (default false) |
limit | [Optional] Limit the number of displayed in shuoshuo |
limit.type | [Optional] Limit type: date or num |
limit.value | [Optional] Limit value: 2024-06-21 or 5 |
Post Front-matter
1 | --- |
Syntax | Explanation |
---|---|
title | [Required] Article title |
date | [Required] Article creation date |
updated | [Optional] Article update date |
tags | [Optional] Article tags |
categories | [Optional] Article categories |
description | [Optional] Article description |
top_img | [Optional] Article top image |
cover | [Optional] Article cover (If top_img is not set, the cover will be displayed at the top of the article. Can be set to false/image address/empty) |
comments | [Optional] Display article comment module (default true) |
toc | [Optional] Display article Table of Contents (default setting in toc's enable configuration) |
toc_number | [Optional] Display toc_number (default setting in toc's number configuration) |
toc_style_simple | [Optional] Display TOC in a simple style |
copyright | [Optional] Display article copyright module (default setting in post_copyright's enable configuration) |
copyright_author | [Optional] Article copyright module's author |
copyright_author_href | [Optional] Article copyright module's author link |
copyright_url | [Optional] Article copyright module's article link link |
copyright_info | [Optional] Article copyright module's copyright statement text |
mathjax | [Optional] Display MathJax (only needed when setting per_page: false for MathJax, default false) |
katex | [Optional] Display KaTeX (only needed when setting per_page: false for KaTeX, default false) |
aplayer | [Optional] Load aplayer's js and css on the specified page, please refer to the music configuration below the article |
highlight_shrink | [Optional] Configure whether code blocks are expanded (true/false) (default is the setting of highlight_shrink ) |
aside | [Optional] Display sidebar (default true) |
abcjs | [Optional] Load abcjs (only needed when setting per_page: false for abcjs, default false) |
noticeOutdate | [Optional] Article expiration reminder (default setting is the enable configuration in noticeOutdate) |
Tags Page
The filename for the tags page doesn’t necessarily have to be "tags"; the "tags" in the example is just for reference.
Remember to add type: "tags"
.
Go to the root directory of your Hexo blog.
Run
hexo new page tags
.You will find the file
source/tags/index.md
.Modify this file:
1 | --- |
Syntax | Explanation |
---|---|
type | [Required] Page type, must be set to tags . |
orderby | [Optional] Sorting method: random/name/length |
order | [Optional] Sorting order: 1, asc for ascending; -1, desc for descending. |
Categories Page
The filename for the categories page doesn’t necessarily have to be "categories"; the "categories" in the example is just for reference.
Remember to add type: "categories"
.
Go to the root directory of your Hexo blog.
Run
hexo new page categories
.You will find the file
source/categories/index.md
.Modify this file:
1 | --- |
Friends Links
Create a page for your blog's friends links!
Create Friends Links Page
The filename for the friend links page doesn’t necessarily have to be "link"; the "link" in the example is just for reference.
Remember to add type: "link"
.
Go to the root directory of your Hexo blog.
Run
hexo new page link
.You will find the file
source/link/index.md
.Modify this file:
1 | --- |
Add Friends Links
In the source/_data
directory of your Hexo blog (if the _data folder does not exist, create it), create a file named link.yml
.
1 | - class_name: Friends Links |
class_name
and class_desc
support HTML formatting, but you can also leave them blank if not needed.
Starting from version 4.0.0
, you can fetch friends links remotely in JSON format.
Note: If you choose remote fetching, the local generation method will be invalid.
In the front-matter of the source/link/index.md
file, add the remote link:
1 | flink_url: xxxxx |
JSON format:
1 | [ |
Random Sorting of Friends Links
The theme supports random sorting of friends links. Just add random: true
in the top front-matter.
Friends Links Page Customization
Starting from version 2.2.0, the friends links page can be customized by the user. You only need to set it in the MD file for friends links using regular Markdown formatting.
Gallery
The gallery page is just a regular page. You only need to create your page using hexo n page xxxxx
.
Then, you can use the galleryGroup
tag plugin galleryGroup for specific usage details.
1 | <div class="gallery-group-main"> |
Subpage
Subpages are also regular pages. You only need to create your page using hexo n page xxxxx
.
Then, you can use the gallery
tag plugin gallery for specific usage details.
1 | {% gallery %} |
If you want to use links like /photo/ohmygirl
to display your image content, you can move the entire ohmygirl
folder to the photo
folder.
404 Page
The theme comes with a simple 404 page, which you can enable in the settings.
When previewing locally, the 404 page won't show up for the error pages.
To preview the 404 page, visit http://localhost:4000/404.html
.
1 | # A simple 404 page |
Shuoshuo Page
Added in V5.0
Please note that the Shuoshuo interface only supports native Markdown format and does not support tag plugins or mathematical formulas.
Creating a Shuoshuo Page
The filename for the Shuoshuo page doesn’t necessarily have to be "shuoshuo"; the "shuoshuo" in the example is just for reference.
Remember to add type: "shuoshuo"
.
Navigate to the root directory of your Hexo.
Enter
hexo new page shuoshuo
.You will find the file
source/shuoshuo/index.md
.Modify this file:
1 | --- |
You can hide some Shuoshuo posts with configurable parameters:
1 | limit: |
Parameter | Explanation |
---|---|
limit | [Optional] Configure the number of Shuoshuo posts to display |
limit.type | [Optional] Configure the type for the number of Shuoshuo posts to display (date or num) |
limit.value | [Optional] Configure the value for the number of Shuoshuo posts to display (when type is set to date, value must be a date. When type is set to num, value must be a number and greater than 0) |
Data Source
In the source/_data
directory of your Hexo root (if there is no _data
folder, please create one), create a file named shuoshuo.yml
.
author
and avatar
are optional and will automatically fetch from the configuration file.
If you need to enable comments, you must configure the key
, otherwise the comment button will not be displayed.
1 | - author: Butterfly |
Parameter | Explanation |
---|---|
author | 【Optional】Author's name |
avatar | 【Optional】Author's avatar |
date | 【Required】Date |
content | 【Required】Content (Markdown or HTML format) |
key | 【Optional】 Unique identifier for comments, required to enable comments |
tags | 【Optional】Tags |
Note: Selecting remote loading will invalidate the local generation method.
Remote pulling only supports json
.
Add the remote link in the front matter of the Shuoshuo page Markdown.
1 | shuoshuo_url: xxxxx |
The format for JSON:
author
and avatar
are optional and will automatically fetch from the configuration file.
1 | [ |
Parameter | Explanation |
---|---|
author | 【Optional】Author's name |
avatar | 【Optional】Author's avatar |
date | 【Required】Date |
content | 【Required】Content (Markdown or HTML format) |
key | 【Optional】 Unique identifier for comments, required to enable comments |
tags | 【Optional】Tags |