How to build a blog of your own

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.

1 Preparation

1.1 GitHub

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!

1.2 Environment

1.2.1 Node.js

First install Node.js. Click to install.

I chose the left which is recommended for most users.

1.2.2 Cmder

Then install Cmder. Click to install.

It’s recommended to click the small blue link. ~58MB 7z

1.2.3 yarn

Third is to install yarn. Click to install.

1.2.4 Hexo

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

λ cd..

Set the Source

λ yarn global add cnpm --registry=https://registry.npm.taobao.org

Then install hexo

λ yarn add hexo-cli

2 Settings

2.1 Initial Blog

Find your folder or place to contain blog and open it with Cmder.

Input the flowing command

λ 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.

λ hexo g

hexo g is short for hexo generate which is to generate your blog

λ 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.

2.2 Add SHH

Back to the Cmder window, press Ctrl+C to exist the server. Then type in

λ 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.

2.3 Configurate your Blog

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

λ 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.

3 Publish new article

3.1 Typora

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.

hexo new article-name

Write your article in markdown and hexo s to preview it and hexo g and then hexo d.

Congratulations!

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.

My Blog

Click to have a look of an finished blog. https://dyingdown.github.io.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值