There are a lot of tutorials on how to build a blog, but it took me a long way to build the kind of blog I want to create. Let’s start with hogenlaw.com. Stormzhang’s blog is similar to this style, but it is based on GitHub + Jekyll, and Jekyll seems to have a Ruby environment. GitHub + Hexo is now used to set up free blogs with more information

In fact, I have been writing notes on CSDN since last year. Although I am still a vegetable, many people say that CSDN is an outdated website, but I do have a lot of questions that I don’t understand are answered on CSDN. Started 17 years I want to try to build a blog, record their technology growth trajectory, and by the way that can improve their writing level, as a result, baidu Google + take turns on, the results to be successful, but I think is not that style of Hexo minimalist style, among a variety of reasons, and almost didn’t write the content in it, Today simply to rebuild, thanks to the brother station’s blog, record more detailed, it is the predecessors of the continuous summary, to have less detours. So after the success of building, I also tried to record my own journey.

This is actually a repetition of the wheel, I do not necessarily write better than others, but I try my best to build the process to record, is a summary of the blog to build it!

Install Node.js and Git

Windows 32-bit installation package download address

Windows 64-bit installation package download address

Git official website download address

The above software to scientific Internet access! Blue light is recommended. As for the installation of the software, there is nothing to talk about, just the next step!

Registered making

I think as long as you can register QQ, wechat, that this is not a matter

Setting SSH check

  • First we need to check whether SSH is installed on this machine: computer desktop –> right click –>git bash here, type the following command

      $ ssh
    Copy the code
  • If the command output is similar to the following, SSH is installed on the host. If not, install it yourself

  • To generate an SSH key: computer desktop –> right click –>git bash here, type the following command

      $ ssh-keygen -t rsa
    Copy the code

This is followed by three consecutive enter keys (no password is required), and two files id_rsa and id_rsa.pub are generated, where ID_RSA is the key and id_rsa.pub is the public key. By default, these two files are generated in the following directories: /c/Users/username/.ssh

Pub to GitHub, so that your local ID_RSA key can be paired with the GitHub id_rsa.pub public key.

Add an SSH key to GitHub

The first step is to go to GitHub Settings and click SSH and GPG keys:

Then click the New SSH Key button in the upper right:

Windows users can open the contents of the ID_rsa.pub file with Sublime Text or EditPlus

After the SSH key is successfully added, run SSH -t [email protected] to test it. If the following message is displayed, the SSH key is successfully added.

Set up a blog on GitHub

Go to Github and click on the + drop down box “New Repository”

Fill in the Repository information:

Repository name: username.github. IO note: userName is your github userName

Description (optional) : Writing 1000 Words a Day Changed My Life

The Repository name of Github Pages is specific. For example, my Github account is Hogenlaw. Github Pages Repository: Hogenlaw.github. IO

Click “Create Repository” to complete the creation

Install Hexo(Watch for high Energy ahead!)

Start by creating a new myBlog folder on any disk in my Computer, such as drive D:

  • Open git and run the Hexo installation command

      $ npm install -g hexo
    Copy the code
  • Enter the myblog directory

      $ hexo init
    Copy the code
  • Ok, now that you have a local blog set up, type the following command to verify

    $hexo G - Generate static file $hexo s - Start service local preview (after preview to stop the keyboard press Ctrl + C to stop local preview)Copy the code

Then go to your browser, type localhost:4000, and a blog pops up

Change the Hexo-Scribble minimalist blog theme

What you saw above is the default Hexo theme, which is now ready to be replaced with a minimalist Hexo-Scribble theme

  1. $hexo Clean – You need to clean the cache generated by the following old themes because the theme changes

  2. Download the Hexo-Scribble theme

     $ git clone https://github.com/hogenlaw/hexo-scribble.git
    Copy the code
  3. Unzip and copy the hexo-Scribble folder to the myblog\ Themes directory

  4. Configure the theme for replication: Modify the theme property in the config.yml configuration file in the myblog directory to hexo-scribble(it is best to back it up before modifying config.yml)

  5. To enable the theme: from the root directory of myblog, go to the theme directory you copied, right click git bash here, and type one or more of the following commands

    $CD themes/hexo-scribble $git pull $hexo g -- generate $hexo s -- start local previewCopy the code

When you’re done, type localhost:4000 in your browser to see if you have any

Writing new articles

$hexo new page "pageName" # new pageCopy the code

The default is a.md format, which means it uses Markdown syntax, Markdown, which is what CSDN is written in!

Ctrl + S to save

Preview your own blog or added blog locally

  • First switch back to the myBlog directory in the command window
  • Then hexo G (generates the web page) and then hexo S (starts the local service), and the browser sees the effect (localhost:4000)

One-click deployment of blogs to GitHub, including topics with newly written articles

  1. Go to the root directory of myblog and right-click git bash here to do the following (replace your username) :

    $git clone https://github.com/ your github username /github username. Github.io. GitCopy the code
  2. Then create a.txt file in the myblog root directory and copy the following command into it (replace your username)

    IO CD. Deploy/Deploy/github username. Github. IO git add Git push origin masterCopy the code
  3. Change the.txt file to.sh and it becomes a script file, so let’s change the file to deploy.sh! That means deploy

If you’ve never logged into Github before, the first time you click deploy.sh, you’ll be prompted for a Github username and password

Push to making

  • Your theme has not been pushed to GitHub, so you need to go to myblog/themes/hexo-scribble in git command window and run the following command:

    $CD themes/hexo-scribble $git pull $hexo gCopy the code
  • Then cut back to the root of myBlog and enter the following build command

      $ hexo g
    Copy the code
  • Finally, publish

    Double-click the deploy. We just in Hexo directory editors sh script file, bring up a black window, synchronization, release, there will be a delay time, no hurry, such as window disappears, the browser enter https://username.github.io

To publish a blog, just run hexo g in the root directory of myblog and click depploy.sh!

PS: After this article, I also wrote a how aboutSync blogs to Github and Coding, I think it is very necessary, after all, Github’s domestic access is slow, you can refer to it if you are interested


For more on building a blog, go to Hogenlaw.com