A Flow of Thoughts

Using Hexo & Github to Create Your Own Blog


Introduction

Personally, I use the blog as a way to keep track of my thoughts. More reflections would be found here rather than technical writings.

However, here is a piece of the latter. It serves to record my process of building my blog using Hexo, and would be a detailed instruction for those beginners and who prefer to launch their own blog without much(actually zero) coding. I hope you find it useful.

Tools Needed

  • Node.js (choose .msi)
  • Github
  • Git
  • Hexo

Creating Github Account

You need a Github Account to start with.
Creating a Github Account is simple with just a visit to their website. (Click on Github)

Creating Repository

To create a repository for your website, go to your own profile page.
This should be a picture of my own profile page. if you can't receive it, it means there is some problem with my picture link...

First enter your account name, and it has to be exactly the same. Then enter .github.io
Below is mine, where alexsixdegrees is my account name, and alexsixdegrees.github.io is the name for this repository.
This should be a picture

After entering, click settings at the right side.

Click Automatic page generator

Continue to Layout

Then you can select any model you want for your website. However, I suggest do not waste too much time on choosing one, since we are going to use hexo’s better-looking models…

Downloading and Installing Tools

So far we have made our first step in making our blog. Next we are going to prepare our tools to set up our blog.

Below is the list of the tools needed to be downloaded:

Download and Install all the tools.
Should be easy and simple.

Installing and Initialing Hexo

Open Git Shell. (How? Ask Cortana)

First of all you need to decide where you should put your blog. Disk C would be fine:

1
cd /

Type the following to download Hexo

1
npm install -g hexo-cli

Afterwards type:

1
hexo

If A list of Commands appears, it means you are on the right track.

Type to Initial:

1
2
3
$ hexo init Hexo
$ cd Hexo
$ npm install

Be sure to type three of them.

Setting Up the Blog

Now, if you finish the above, you can go to Disk C and find a file called Hexo.
Enter the file, find _config.yml
Open it use your notepad.

We would fill in some of the information:

1
2
3
4
5
title: #the title of your website
subtitle: #the subtitle
description: #description
author: #Your name
language: en

url:
the link of your own website page (the one we just create)

Then go to your Github Page, Open the Repository, Click “Clone or download”

Change the following settings, paste your URL:

1
2
3
4
deploy:
type: git
repo: #your URL
branch: master

Save the file.

Then go to Git Shell, and ready to publish your first article.
type

1
2
3
$ cd /
$ cd Hexo
$ hexo new "the title of the article"

Check the source file in Hexo file. There is a _post file within it. Enter it, and there is your new article.
You should see:

1
2
3
4
5
---
title: "the title of the article"
date: 2017-02-07 22:04:09
tags:
---

You can type anything below the ——— to be your content.
Save the file.

Go back to the Git Shell.
Type:

1
$ hexo server

You are able to see your own blog now on the local host.

Enjoy the moment.

Deployment

This is the tricky part.
Deployment allows to set up our local blog on the Github Page.
Open Git Shell:

1
$ hexo g -d

If it works, you would find your github page become the same as the local host.
Otherwise, try:

1
2
3
$ hexo generate
$ npm install hexo-deployer-git --save
$ hexo deploy

This should work, and you would find your github page the same as the local host.

That’s ALL.

And here is your blog.
In the future, you have to use Markdown Editor to write and publish your blog. It’s an astonishingly simple language that can be mastered within minutes. You can find the tutorial here as well.
If you are not satisfied with your current hexo theme, try to search for some more themes. You can find more recommended themes here as well. For more detail, visit hexo’s official document.
If you have any questions, feel free to contact me via email: alexsixdegrees@outlook.com

Hope you find it useful.