How to use hexo to build a personal blog on github?(7 steps)

If you want to build your personal static content blog on github. You come right place. This article will introduce how to do it, what problems I met and how to solve it during the implementation of this personal static content blog.

Here we go.

Step 1: Hexo

To understand Hexo.

Step 2: Install GIT

GitHub Windows. After install Github Windows. You will get Git shell and desktop github.

Step 3: Install Node.JS

Node.JS

Step 4: Install Hexo

After install GIT, we got Git Shell, open and type the below commands.

$ npm install hexo-cli -g
$ npm install hexo --save

Step 5: Configure Hexo

In Git Shell, we use “cd [path]” command to change the directory to where you plan to configure the Hexo. And type the below commands.

hexo init
npm install

Install hexo plugins.

npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save
npm install hexo-deployer-git --save
npm install hexo-deployer-heroku --save
npm install hexo-deployer-rsync --save
npm install hexo-deployer-openshift --save
npm install hexo-renderer-marked@0.2 --save
npm install hexo-renderer-stylus@0.2 --save
npm install hexo-generator-feed@1 --save
npm install hexo-generator-sitemap@1 --save

Step 6: View the result in local place

Type the below command and you will get the information which tell you to view your website by localhost:4000.

hexo server

Until now. You have already build a website. But you need to employ it to github. So let’s continue.

Step 7: Deploy to github

  • Apply for a github account and create a Repository. (As for how to create a Repository, please refer to official document.)
  • Open the desktop Github, click the “+” button on the top left corner. Input a name, then set Local Path to a certain place. It depends on your choice.
  • In Git Shell, change the directory to the hexo directory. and run “hexo g” command, it will create a public folder.
    Note:
    $ hexo g == hexo generate(生成静态文件)
    $ hexo s == hexo server(启动服务器)
    $ hexo d == hexo deploy(部署到github上面。)
  • Copy the public folder to the root of Local Path.
  • After click submit button in desktop github. Click “syn” button on the top right corner.
  • Go to the github in website. In your blog repository. Click Setting option. You will find your blog URL. Like this [https://xmhuster.github.io/MBlog/], this is my website, which was created by using hexo and github.

Now, I hope you also have already build your personal blog.

Theme

Hexo has a lot of themes, and there are templates for you to click on and modify, as well as good documentation on the site.

Write articles

How to write the articles? we use Markdown to write articles. The syntax is pretty simple. You can master it quickly. Please refer to its official document.

How to install comment by using Disqus

  • Sign up an account for Disqus.
  • GetStart->I want to install Disqus on my site->create a new site->save. After do it. It will create a shortname.
  • Under the hexo folder, there is a config.xml. In my version, add the shortname to “disqus_shortname:“.
  • Done

Have fun and Have a nice day.

If you’d like to build a website by using your own host and domain, please refer to my another artilcle (How to Build Your Website and Start a Blog only in 6 Steps).

If you have any questions or suggestions, you can write a comment. I‘d like to get some feedback from you guys. Thank you!!

Share this article to your social media
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments