This is the second day of my participation in the August More Text Challenge

All about Hexo — My Hexo column

Zero wedge

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.

I stumbled across Hexo, a static blog site, and through Github binding, you can create your own blog site without having to buy a server.

Because I am not familiar with the front end, I also experienced many pits in the process of building, now I will share the process of building, hoping to provide you with some help. Here are two of my blog sites: Gitee. IO and Heeh. xyz, and you can check them out and see what they look like.

Best of all, it’s free, and there are plenty of plugins and blog theme templates that you can customize to your liking.

Start building your own blog now. What questions can be discussed in the comments section, feel useful brother MOE can point a thumb-up 😝

Operating environment preparation

Environmental information of this paper:

  • Win10 + VSCode (can be any text editor)
  • Node.js
  • Git
  • Change NPM to Taobao image source and set CNPM
  1. Download the environment just click on the website to find their own version of the installation can, here do not repeat 🍉.

  2. After the installation is complete, run the CMD command to enter node -v, NPM -v, and git –version to verify the installation. If the following figure is displayed, the installation is successful.

  3. Change the mirror source of NPM to taobao mirror source which is more stable in China (it is recommended to set permanently)

    Temporary change image source NPM - registry=https://registry.npm.taobao.org # # permanent set to taobao image source NPM config set registry https://registry.npm.taobao.org # CNPM installation, Poor server can use abroad CNPM instead of NPM command NPM install - g CNPM - registry=https://registry.npm.taobao.orgCopy the code

Two dead simple to prepare

  1. Open GitHub and log in to your account.

  2. Create a repository with your username.github. IO

  3. Git Bash Here:

    Git config --global user.email "git config --global user.email"Copy the code
  4. Gitconfig file can be found in C:/Users/[username]/. Gitconfig file (if you can’t find it, please open it to show Windows to show hidden files), use the editor to see the following content, indicating that the configuration is successful.

Three installation Hexo

  1. Create a new directory 👀 to save your blog files. Go to the Git command line and type:

    -g hexo-cli # Wait for the previous command to complete, then enter the following command hexo init # install the dependencies required by the blog NPM installCopy the code

    💥 Tips: One of the great things about Hexo is that if you have any problems during the installation process, you can delete the folder and start again. Note that all subsequent operations should be performed in this folder directory ~

  2. Wait until the run is complete, you will find that there are a lot of files in the folder. Now that the local setup is complete, let’s try to run it by typing the following command:

     hexo g
     hexo s
    Copy the code

  3. Following the prompts to open http://localhost:4000, you can see the generated web page, indicating that Hexo has successfully run locally.

4. Post to Github

Now that Hexo has been downloaded, installed and run locally, we will publish your local blog to Github so that others can access your blog via the url.

  1. Open the Git command line in your local folder and type the following commands respectively

    # xplo-deployer-git --save # xplo-xplo-xplo-git --save # xplo-xplo-xplo-git --saveCopy the code
  2. Open id_rsa.pub and copy the contents of the.ssh folder in C:/Users/[username]. Then open Github, click on your profile picture Settings in the upper right corner and select SSH and GPG Keys.

  3. Click New SSH Key to paste the previously copied content into the key box, Title can be optional, click Add SSH key to complete the addition.

  4. Go back to the CLI to check whether the connection to Github is successful. Type SSH -t [email protected]. A message is displayed asking You’ve successfully entered yes. The connection is successful.

  5. Go to the blog site directory and open _config.yml in a text editor. This is the blog configuration file that will be used a lot in the future.

  6. Then slide to the bottom of the file and add the following code:

    Type :git repo: [email protected]:github username /github username Github.io. Git branch: masterCopy the code

  7. Finally, to generate the page and publish it, we execute the following command:

    # generate, Hexo will generate a static page based on the configuration file Hexo g # deploy, upload the files from the previous step to Github Pages Hexo d # Complete rendering and uploading hexo G-d directlyCopy the code

    Once the upload is complete, open your github username.github. IO in your browser and view the uploaded page. If the page looks like it did during local debugging, the upload is complete. If not, check the command line window for error messages. If not, wait or press CTRL + F5 refresh to clear the browser cache.

Five articles

  1. Create or modify mD-formatted posts in the /source/_posts directory of the blog folder. Add at least the following front-matter field before each post.

    -- Title: Hexo Article Date: 2021-08-17 22:25:00 --Copy the code
  2. Each upload should be typed on the command line:

     hexo cl
     hexo g -d
    Copy the code

All see here, a thumbs up bai 😆

Plugins and theme recommendations will be updated within the next two days ~ welcome to contact us ❤

More interesting articles: Mancuoj’s homepage – Articles – Nuggets (juejin. Cn)