I have looked up a lot of information and consulted all kinds of great men. I want to summarize this process, and the steps are as detailed as possible. I hope it can be useful to those who need it. This article is divided into three parts:

  • Blog Building process
  • Changing the theme file
  • Configuring a Personal Domain Name

Blog Building process

Before setting up your blog, please check whether there are node. js and Git development environments on your computer. If you have not installed them before, please install them by yourself.

  • Git
  • Node.js
  • Github Github is used as a remote repository for blogs. If you do not have an account, you need to apply for an account.

Install Hexo

Before installing Hexo, ensure that the git and Node.js environments have been installed and the GitHub account has been applied, and we are ready to install hexo. You can start by creating a new folder locally to hold the blog directory, open the console and enter the following command to install Hexo.

1Copy the code
sudo npm install -g hexoCopy the code

Once installed, you can type hexo-version to see if hexo is installed correctly, as shown in the figure below:

If, after you input this command, the same interface as mine appears, then congratulations you, the first step has been completed, (~ ▽ ~)~*

Initialization

1. HEXO INIT

To open your local development directory, type CD XXX (the development directory you created) into this directory and do the following: for example, I created a folder called hexo_blog to hold my blog.

1Copy the code
Hexo init Your directory nameCopy the code

After successful initialization, some files will be automatically created in the directory. My file directory looks like this:

After the initialization is successful, the following directories exist in the file:

2. Generate a static page

Enter the following command on the console to automatically parse and generate HTML files.

1Copy the code
hexo generateCopy the code

3. Preview the information locally

Enter this command on the console to preview the blog locally.

1Copy the code
hexo serverCopy the code

Success is shown below:

Open your browser and enter the url in the red box to preview the website. Ctrl+C to pause.

Create a GitHub project

This step assumes that you have created a GitHub account.

  • Creating a new project

    Log in to your GitHub homepage and click on the upper right corner:

  • Name and Description

    The Repository Name is requiredXXX.github.io(Note here:XXXIt needs to be the same as your GitHub username) As shown in the figure:



    Feel free to fill in the instructions, and then click the Create button.

  • SSH configuration key configuration here not to say more, not configured partners can search for their own good.

4. Configure the deployment

1. Modify the configuration file

After the GitHub project is created, go back to our local directory. We have shown you the directory structure of local files after initialization:

What we need to fix is_config.ymlThis file, go to your directory and find this file and modify it.

Open this file and find the location in the image:

(Note: space must be added after semicolon)

1234Copy the code
deploy: type: git repo: [email protected]:GKrace/GKrace.github.io.git   branch: masterCopy the code

Among them,repoGet the value for the GitHub project clone address you created:

2. We also need to install a library

Enter on the consolenpm install hexo-deployer-git --save

After success:

3. Last step:

1Copy the code
hexo deployCopy the code

To open your blog, type in the url: https://XXX.github.io/.

At this point, hexo completes the blog building process ଘ(ᵕ, ଓ)ଓ *

4. Common commands

  • For the rest of the maintenance, just execute the following command to update the blog:

    1Copy the code
    hexo clean && hexo g && hexo dCopy the code
  • Common command parsing:

    1234567Copy the code
    hexo new "Name" # hexo generate static page to public directory hexo server # 'CTRL + C' close the server) hexo deploy # Deploy the. Deploy directory to GitHubhexo help # View the help hexo version # View the version of hexoCopy the code

Changing the theme file

Hexo offers a variety of themes to choose from, and then shows you how to change them. IO/Themes/web site 2: github.com/hexojs/hexo… First of all, you can choose a theme you like. For example, my theme is Yilia

1. git clone

Open the GitHub page where the theme is located. General theme publishers will provide instructions on how to use the theme and clone the address in the readme.

1Copy the code
git clone XXXXCopy the code

2. Modify the Hexo configuration file _config.xml:

1Copy the code
theme: yiliaCopy the code

Configuring a Personal Domain Name

1. Open the official website of Aliyun

Individual domain name steps, we need to buy a favorite domain name, can choose a different suffix, suffix is different, the price is different

  • The login

    1Copy the code
    https://wanwang.aliyun.com/Copy the code
  • Once logged in, click the console

  • Look at the left navigation bar, select the domain name and the domain name under the website:

  • Now you can see the status of your domain name, click Resolve:

  • Click Add Parse,

    Note: Don’t forget to add the name., the correct form isXXX.github.io.

  • Finally, go back to the local, create a new file in the public folder, and fill in your domain name

  • Run hexo clean && hexo g && hexo d go to GitHub and check whether the CNAME file has been uploaded successfully

If you have completed the above steps, you can open your domain name and check your blog. 2) ㅂ•́)و✧

Github Pages HTTPS From: itoss.me