Step 1 Install Node.js
To install Node.js on Windows: go to nodejs.org/en/download… Installation files. It is recommended to download Nodist to facilitate node version management.
Step 2 Install Git
Download Git from the official website.
Step 3 Hexo installation and use
- Installation:
Right click git bash here on your desktop and type the following command:
npm install hexo -g
Copy the code
- Initial configuration:
Git bash here to create a folder (D: self\myBlog).
hexo init
npm install
Copy the code
- Install the hexo plugin (to ensure that some operations do not go wrong later, the following code can be copied and pasted into the command window):
npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save
npm install hexo-deployer-git --save
npm install hexo-deployer-heroku --save
npm install hexo-deployer-rsync --save
npm install hexo-deployer-openshift --save
npm install [email protected] --save
npm install [email protected] --save
npm install hexo-generator-feed@1 --save
npm install hexo-generator-sitemap@1 --save
Copy the code
- Local view effect:
hexo generate
hexo server
Copy the code
This allows you to access localhost:4000 in your browser
Step 4 Deploy the blog to Github Pages
- Start with a Github account.
- Create a new repository and copy the HTTPS link to the repository you created.
- Open _config.yml in the myBlog folder
Modify in configuration file: (Remember: always have space after colon!)
Deploy: type: git repository: HTTPS link to the repository you created branch: your branchCopy the code
- Execute under myBlog folder:
hexo g -d
Copy the code
- I deployed to the master branch and set the master branch to site, so I can access the repository link created to see the effect.
Note: if you cannot access the CSS/js file, the path is not correct. In this case, you can modify the root value in _config.yml to change root to your path.
Step 5 Add themes to beautify your blog
- Go to hexo. IO /themes/ and select…
- Right-click in the Themes directory of the myBlog folder and go to the git command box:
I chose the hexo-theme-next theme
Git clone https://github.com/iissnan/hexo-theme-next (address with the one you need to use the theme of)Copy the code
After downloading. 3. Modify theme:hexo-theme-next to _config.yml in myBlog directory Deploy to Github:
hexo clean
hexo g -d
Copy the code
- Open your own home page to see the effect.
Step 6 Configure categories and labels
- Execute under myBlog folder:
Hexo new Page "Categories" hexo new Page "tags" // Create tagsCopy the code
- Open index.md under /source/ Categories and change it to:
---
title: catagories
date: 2017-06-11 19:40
type: "categories"
---
Copy the code
- Open index.md in /source/tags and change it to:
---
title: tags
date: 2017-06-11 19:40
type: "tags"
---
Copy the code
- Open the Scaffolds /post.md file and add a line of Categories above tags:
- Create a new page:
hexo n "fisrtPage"
Copy the code
Set categories to the value you want to categorize. If there are multiple categories, set the categories to the following:
tags: [tag1,tag2,...]
Copy the code
Other Settings
- Set up Chinese
Find language in the _config.yml file and set it to language: zh-hans 2. Go to the _config.yml folder in the theme folder (such as themes’ hexo-theme-next) and go to the menu configuration:
menu:
home: / || home
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
Copy the code
- The home page does not display the full text of the article Settings:
Find _config.yml in the theme folder you are using (such as Themes’ hexo-theme-next)
auto_excerpt:
enable: true
length: 150
Copy the code