This article is translated from ChatGPT.
π¦ Butterfly has been updated to 4.10.
π Table of Contents
π Get Started - π Theme Pages - π Theme Configuration Part 1 - βοΈ Theme Configuration Part 2 - β 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) |
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) |
Tags Page
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:
Remember to add
type: "tags"
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
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:
Remember to add
type: "categories"
1 | --- |
Friends Links
Create a page for your blog's friends links!
Create Friends Links Page
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:
Remember to add
type: "link"
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 |