After all these days of staying up late, I finally build up my own blog by asking a big boss and searching online. The followings are some detailed contents of how I actually built it.
You need to have a GitHub ID so that’s where you can host your blog. Click here to Sign up for GitHub or Log in.
Then click the new button on the left to create a new repository.
Then comes to this page.
NOTICE: The format of your repository name is yourGitHubName.github.io This is also your website address. Make sure to select Public NOT Private.
Then click create repository button. The repo is successfully created!
First install Node.js. Click to install.
I chose the left which is recommended for most users.
Then install Cmder. Click to install.
It’s recommended to click the small blue link. ~58MB 7z
Third is to install yarn. Click to install.
The last thing is to install Hexo.
Open the Cmer.exe that you have just installed.
Return to the previous directory. Keep return to the file you want to settle your blog
1 | λ cd.. |
Set the Source
1 | λ yarn global add cnpm --registry=https://registry.npm.taobao.org |
Then install hexo
1 | λ yarn add hexo-cli |
Find your folder or place to contain blog and open it with Cmder.
Input the flowing command
1 | λ hexo init blog |
The word after init is your folder name which you can name it arbitrary.
After initial your hexo, there will be a automatically generated passage hello-word.md. Run the command to see what it looks like.
1 | λ hexo g |
hexo g is short for hexo generate which is to generate your blog
1 | λ hexo s |
hexo s is short for hexo server which is to open the sever. After it is done, you can open http://localhost:4000/ to see what is it looks like.
Back to the Cmder window, press Ctrl+C to exist the server. Then type in
1 | λ ssh-keygen -t rsa -C "the email address of GitHub" |
After some Enter, you get the message:
Your public key has been saved in /c/Users/user/.ssh/id_rsa.pub.
Find the file and open it, copy all the content in it and past it in http://github.com/settings/ssh.
Title is arbitrary.
Open the file _config.yml under the directory of your blog.
Edit the things in your own favor. Remember there is a space after the colon or it will be a syntax error. And the repo is your website address.
After all is done, back to the cmder window and generate using hexo g. Then type
1 | λ hexo d |
d stands for deploy that is to send your local settings to the repo. During deploying, it will come out a login block, just login your GitHub is OK.
**Note: ** If you see this ERROR Deployer not found: git
, you should install hexo-deployer-git
.
To publish articles, hexo uses markdown. You can search on the website to see what exactly is markdown. And here is basic sytax of markdown.
I recommended to use typora to write markdown. Click to download.
Type in your cmder window to generate a new md file.
1 | hexo new article-name |
Write your article in markdown and hexo s to preview it and hexo g and then hexo d.
Now you’ve built your blog and have your first post. Isn’t it easy and fun?
In the next passage I’m going to talk about how to change theme of your blog.