This article is translated from ChatGPT.

πŸ¦‹ Butterfly has been updated to 4.10.


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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
title:
date:
updated:
type:
comments:
description:
keywords:
top_img:
mathjax:
katex:
aside:
aplayer:
highlight_shrink:
random:
---
SyntaxExplanation
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
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
---
title:
date:
updated:
tags:
categories:
keywords:
description:
top_img:
comments:
cover:
toc:
toc_number:
toc_style_simple:
copyright:
copyright_author:
copyright_author_href:
copyright_url:
copyright_info:
mathjax:
katex:
aplayer:
highlight_shrink:
aside:
abcjs:
---
SyntaxExplanation
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

  1. Go to the root directory of your Hexo blog.

  2. Run hexo new page tags.

  3. You will find the file source/tags/index.md.

  4. Modify this file:

    Remember to add type: "tags"

1
2
3
4
5
6
7
---
title: Tags
date: 2018-01-05 00:00:00
type: "tags"
orderby: random
order: 1
---
SyntaxExplanation
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

  1. Go to the root directory of your Hexo blog.

  2. Run hexo new page categories.

  3. You will find the file source/categories/index.md.

  4. Modify this file:

    Remember to add type: "categories"

1
2
3
4
5
---
title: Categories
date: 2018-01-05 00:00:00
type: "categories"
---

Create a page for your blog's friends links!

  1. Go to the root directory of your Hexo blog.

  2. Run hexo new page link.

  3. You will find the file source/link/index.md.

  4. Modify this file:

    Remember to add type: "link"

1
2
3
4
5
---
title: Friends Links
date: 2018-06-07 22:17:49
type: "link"
---

The theme supports random sorting of friends links. Just add random: true in the top front-matter.

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.

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
2
3
4
5
<div class="gallery-group-main">
{% galleryGroup 'Wallpapers' 'Collection of some wallpapers' '/Gallery/wallpaper' https://i.loli.net/2019/11/10/T7Mu8Aod3egmC4Q.png %}
{% galleryGroup 'Marvel' 'Pictures related to Marvel' '/Gallery/marvel' https://i.loli.net/2019/12/25/8t97aVlp4hgyBGu.jpg %}
{% galleryGroup 'OH MY GIRL' 'Pictures related to OH MY GIRL' '/Gallery/ohmygirl' https://i.loli.net/2019/12/25/hOqbQ3BIwa6KWpo.jpg %}
</div>

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
2
3
4
5
6
7
8
9
10
{% gallery %}
![](https://i.loli.net/2019/12/25/Fze9jchtnyJXMHN.jpg)
![](https://i.loli.net/2019/12/25/ryLVePaqkYm4TEK.jpg)
![](https://i.loli.net/2019/12/25/gEy5Zc1Ai6VuO4N.jpg)
![](https://i.loli.net/2019/12/25/d6QHbytlSYO4FBG.jpg)
![](https://i.loli.net/2019/12/25/6nepIJ1xTgufatZ.jpg)
![](https://i.loli.net/2019/12/25/E7Jvr4eIPwUNmzq.jpg)
![](https://i.loli.net/2019/12/25/mh19anwBSWIkGlH.jpg)
![](https://i.loli.net/2019/12/25/2tu9JC8ewpBFagv.jpg)
{% endgallery %}

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
2
3
4
5
# A simple 404 page
error_404:
enable: true
subtitle: "Page not found"
background:

πŸ“Œ Butterfly document - Theme Configuration Part 1