Build a Blog with Hexo and Github Pages (2)

Part 2: Theme and Configuration

The default theme is landscape, but there are tons of Hexo Themes.
Alternatively, you can choose a theme directly on Github by searching key words Hexo theme and sorting by Most stars.

Hexo Themes

Theme NexT

I decided to use the theme NexT with the largest number of stars on Github.

Install NexT with git:

1
$ git clone https://github.com/iissnan/hexo-theme-next themes/next

There are two _config.yml in the blog folder. ~/blog/_config.yml is the site config, ~/theme/next/_config.yml is the theme NexT config. Be sure not to mess them up.
Refer to Hexo Docs Configuration to finish your site config.

After installing NexT theme, you need to edit site config:

1
2
## Themes: https://hexo.io/themes/
theme: next # default theme is landscape

Now your new theme should be installed successfully.

Site config

I made changes to the URL format as I pasted my config below. The definition of the variables can be found at Hexo Permalinks.

1
2
3
4
5
# URL
url: https://chongwng.github.io
root: /
permalink: :year-:month/:title/ # I made changes here
permalink_defaults:

In this format, you’ll find your blogs will be stored monthly in the public folder instead of being stored daily as the default settings.

Front-matter

According to Hexo Docs, this is an easy way for you to define your article basic format.
You can modify draft.md, page.md, and post.md in the scaffolds folder, which are three types of page structure in the hexo.
My front-matter is below:

1
2
3
4
5
---
title: {{ title }}
tags:
categories:
---

Read More

Add <!-- more --> below the abstract of your post.

Now you can create your first post. I’ll introduce more advanced theme config in my next blog.

0%