YAN's BLOG

How to create Github IO blog

2018-12-31

Create github io repo

Github provides free host for the blog. Simply follow instructions to create a repository naming .github.io

Get Hexo Ready

I used Hexo, which is a simple static blog framework built on Node.js, to create my pages. You can also use JekyII as recommended by github.

Intall Hexo

1
$ npm install -g hexo-cli

Initialize Hexo blog under

1
2
3
$ hexo init <my-blog-folder>
$ cd <my-blog-folder>
$ npm install

Find a theme, I used a Vue style one by yanm1ng

  1. Download theme /theme

    1
    2
    3
    $ cd <my-blog-folder>
    $ git clone <theme-git-repo> themes/<theme-name>
    $ cp -R themes/<theme-name>/_source/* source/
  2. Update project _config.yml theme config

    1
    themes: <theme-name>

Deploy to your github io repo

Install hexo-git-deployer

1
$ npm install hexo-deployer-git --save

Edit _config.yml

1
2
3
deploy:
type: git
repo: https://github.com/dongnanzhy/dongnanzhy.github.io

Deploy

1
$ hexo clean && hexo deploy

Add new blog

Create new post page under source/_posts

1
$ hexo new post <title>

If image files included, add them under source/images

Deploy

1
$ hexo clean && hexo deploy