Hexo Miscellaneous

Some useful tips for Hexo

Hexo Seal

Front Matter

Front matter matters!
See my template below for suggestions.

Layout Template

We can customize the template for our post so that we do not need to memorize too much about front matter. The files are under /scaffolds directory.
Below is my template for posts:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
categories:
- Skills
- Web
tags:
- tech
- hexo
date: 2017-09-09 06:18:20
title:
top:
thumbnail: * the path of the pic should be included!
permalink:
password:
abstract:
---
> ### Your subtitle here
<!-- more -->
{% asset_img thumbnail.jpg caption %}
{% asset_img XXX.jpg caption %}

Including A Standalone Webpage

If we want to include a standalone webpage that is not interfered with by Hexo, we can add it under /source directory as an HTML file. For example, this page. Notice that in order to prevent Hexo from rendering it, we need to add two lines

1
2
layout: false
---

Creating A Page That Is Not A Post

Like my about page, hexo has a different class of files from posts that is pages. A page cannot be referenced from the navigation bar (except about page, which is unique) or the left column of thumbnails. Different from a standalone page, it is rendered by hexo to keep the style in accordance with the general website.

To create a hexo page, create a folder XXX under any directory under /source. Then create a file named index.md in that folder. A folder index is optional, depending on if you have assest pictures to include in the markdown file. You can now treat the files the same as posts, and they will be rendered to become pages. An example of this is this page.

Share