Use Hexo to build your own blog-recording process

Posted by bloodgoat on Thu, 03 Mar 2022 20:29:59 +0100


Use Hexo to build your own blog site
To use Hexo, you must first make sure that node is installed on your computer. JS and git environments
The former is an environment capable of running JavaScript code on the server side, and the latter is a version control tool.
Install node.js is mainly designed to use its package management tool npm, so there is no need to learn the node systematically first. Knowledge of JS
git was installed to use version control systems to clone code and have hosted blog items on a three-party platform
mac computers generally have git environments, which can be left unattended.
We need to download the node.
Download address:

PART ONE - Environment Construction

After downloading, open the terminal and switch the root user

sudo su 
//Use npm to install dependent packages, which is slow. It is recommended to install Taobao Mirror and use cnpm for subsequent commands
npm install -g cnpm --registry= 

After downloading npm, use NPM to download hexo

cnpm install -g hexo-cli 

After downloading hexo, check the version of hexo

hexo -v

Once you have downloaded hexo, you can generate a blog directly with one command

hexo generate

This command can also be abbreviated as

hexo g

Start Server

hexo server

Can also be abbreviated as

hexo s

Clicked Page
We can already see that Hexo generated the home page without configuring it or adding its own Markdown file, as shown in the following image

PART TWO - Web Blog Beautification

Next let's modify the blog configuration file

vim _config.yml

The following shows:

# Hexo Configuration
## Docs:
## Source:

# Site
title: Von Jana's Blog
subtitle: 'Whose family is Von Jana cute?'
description: 'Record, share, learn'
author: Von Jana
language: zh
timezone: ''

## Set your site url here. For example, if you use GitHub Page, set url as ''
permalink: :year/:month/:day/:title/
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang

PART THREE - Host your blog with Github

We can use the Pages service provided by GitHub to host our blog. There's a tutorial on the first page of GitHub Pages that teaches us how to host our own website. The first step, of course, is to register an account on GitHub so that we can follow up after successful login.

Create a warehouse with your own user name. The warehouse must be named "User"
For example: My user name on GitHub is jianafeng55, so my repository for hosting blog projects must be named
After creating this repository
Continue modifying profile_ config.yml

vim _config.yml

Modify to

# Deployment
## Docs:
  type: git
  branch: master

Install a deployer plug-in called hexo-deployer-git, which enables one-click deployment.

npm install hexo-deployer-git --save 
hexo deploy -g


hexo d deploy

Enter the corresponding github username and key

Username for '': jianafeng55
Password for '': 

[You can't log on with a github password now, you must create a key to log on]
Refer to this article for creating key tokens

References or Web site links:

Topics: git github