Build hexo blog quickly

Hexo is a fast, concise, and efficient blogging framework. Hexo uses Markdown (or other rendering engines) to parse articles and generate static web pages with beautiful themes in seconds.

Prerequisite: Node and Git must be installed on your computer

1. Install Hexo and build the project

npm install -g hexo-cli
hexo init <folder>
cd <folder>
npm install
Copy the code

A default blog MD file is automatically generated after the setup is complete

2. Run the project locally

hexo server
Copy the code

Here’s a new hello-World blog post

3. Create a blog

hexo new [layout] <title>
Copy the code

Create a new article. If layout is not set, default_layout in the _config.yml file is used by default. If the title contains Spaces, enclose them in quotation marks.

hexo new "post title with whitespace"
Copy the code

Deployment of 4.

Install hexo deployer — git

npm install hexo-deployer-git --save
Copy the code

Modify the configuration

deploy: type: git repo: <repository url> #https://github.com/linsmallsail/myBlog.git branch: [message] # custom commit messageCopy the code

Build the site and push it to the remote repository

hexo clean && hexo deploy
Copy the code

Hexo Clean: Clears cache files (db.json) and generated static files (public). In some cases (especially after changing themes), you may want to run this command if you find that your changes to the site are not taking effect anyway.

Change the Hexo theme

Open the website, find a theme you like under themes and click on the name to start the GitLab codebase

Copy the repository address of the topic

Go to the root directory of the blog and execute the following command to modify the theme, again hexo server

git clone Github.com/sharvarides… themes/edinburgh