preface

In fact, I had the idea of setting up a personal technology blog when I was a senior intern, but I was still lazy and put it on hold for a long time. Sent a while ago in the nuggets a few article written before, harvest a lot of praise and reading, a little achievement, so that power drive yourself ~ some people feel the need to build a personal blog to buy domain name, need to spend money, not really, a lot can help us free to generate a static url, it will be mentioned later.

What is a Hexo

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. Attached is Hexo’s Chinese website. Let’s go through the setup steps in detail.

Install Git Bash

Git Bash is a command line tool for Git on Windows.

  • Download address
  • Installation steps: Double-click the downloaded EXE file, all the way to next
  • Confirm success: Executegit versionIf the console prints the git version, the installation is successful.

Install the Node

Hexo is a static blog based on the Node environment, and NPM tools are essential.

  • Download address
  • Installation steps: Basic operations are not described here.
  • Confirm success: Executenode -v, the console prints the corresponding Node version, indicating that the installation is successful.

Install Hexo

  • Create a local folder for your blog, and thencdGo to the corresponding directory.
  • Installation command:npm i -g hexo(suggest usingcnpmInstallation, which is relatively fast)
  • Confirmation successful:hexo -v

  • Initialization:hexo init, and then open the folder as shown below:

  • Explain briefly what folders are for

Node_modules: dependency package

Scaffolds: Templates for commands to generate articles, etc

Source: Various articles created with commands

Themes: the theme

_config.yml: Configuration of the entire blog

Package. json: configuration information of the module project required by the project

Bypass to making

  • Do not have an account to create an account (program ape should not ~), have an account to see the following steps:

  • Go back to Gitbash and configure the Github account information (replace YourName and YourEail with your own)

  • Create SSH at gitbash by typing:ssh-keygen -t rsa -C "[email protected]Generate SSH, and then follow the following figure to find itid_rsa.pub

  • Put the obtained SSH on Github:

finishing

  • Open the blog project in the editor and modify it_config.ymlSome configuration of the file (Remember that the colon must be followed by a space, otherwise the configuration will not work, this is a pit for Hexo!)
deploy:
  type: git
  repo: https://github.com/YourgithubName/YourgithubName.github.io.git
  branch: master
Copy the code
  • Enter the blog project and execute the following commands respectively:
hexo clean
hexo generate
hexo server
Copy the code
  • Open your browser and enter:http://localhost:4000The time has come to witness the miracle

Uploaded to the lot

  • Install the Hexo upload repository tool and runnpm install hexo-deployer-git --save“So that your article can be deployed to github.
  • Execute command (recommended to do this every time, clean first, compile and upload later)
hexo clean
hexo generate
hexo deploy
Copy the code
  • Type in the browserhttp://yourgithubname.github.io, so you can see your own online blog ~

Optimization of the blog

Some children’s shoes a start to see this blog, wow, good ugly ~ everybody is experienced, the default theme is not good-looking, there are Hexo theme website, there are currently 195 your choice of topic, change a can change every week for three years ~ (of course you can do I also served ~) specific how to install the theme, there are lots of details, enter the address of the corresponding I won’t go into it here. Here show a wave of my personal blog address, free to brush PV is also very OK ~

Writing a blog

And finally, how to blog?

  • New article:Hexo new 'name'You can then see it in the source folder of your blog.
  • Write content: Markdown syntax is supported, so I am using the Nuggets markdown editor to write and copy articles from it
  • Upload to Github if you have seen it locally. As mentioned in the previous step, github server will have a little delay after uploading. Refresh after 10 minutes should have the latest blog.

At the end

Embers’ personal blog (will be updated frequently)