Wanna make your first blog? I recommend using hexo to build your blog! In Hexo, All features of GitHub Flavored Markdown are supported. You can even use most Octopress plugins in Hexo, and Node.js brings you incredible generating speed.

What you need

Git

Nodejs

VScode (Optional)

I recommend using Typora to edit markdown files.

Install Hexo

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo npm install -g hexo-cli

$ hexo -v
hexo-cli: 0.1.9
os: Darwin 14.3.0 darwin x64
http_parser: 2.3
node: 0.12.7
v8: 3.28.71.19
uv: 1.6.1
zlib: 1.2.8
modules: 14
openssl: 1.0.1p

Create a project for your GitHub Pages

1
2
3
4
5
6
7
$ hexo init [githubaccount].github.io
INFO Copying data to ~/***/[githubaccount].github.io
INFO You are almost done! Don't forget to run 'npm install' before you start blogging with Hexo!

$ cd [githubaccount].github.io

$ npm install

Run a test server for your page on Mac

1
2
$ hexo server
INFO Hexo is running at http://0.0.0.0:4000/. Press Ctrl+C to stop.

Set information for your new blog

https://hexo.io/docs/configuration.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Site
title: [githubaccount]'s note
subtitle:
description: [githubaccount]'s personal blog
author: [githubaccount]
language:
timezone: Japan

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://[githubaccount].github.io/
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

Set information to use Git

https://github.com/hexojs/hexo-deployer-git

1
2
3
4
5
6
7
8
9
10
$ npm install hexo-deployer-git --save
$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:[githubaccount]/[githubaccount].github.io.git
branch: master

Set “watch” before starting your work

“watch” command can monitor your files.
https://hexo.io/docs/generating.html

1
$ hexo generate --watch

Create a new post file

1
2
$ hexo new first-post
INFO Created: ~/***/[githubaccount].github.io/source/_posts/first-post.md

Edit the above file with Markdown or Hexo’s Helper

Hexo’s Helper
https://hexo.io/docs/helpers.html
I use Atom with “shift + control + m” when I use Markdown :-)
https://atom.io/

Delete “source/_posts/hello-world.md”

It’s not necessary to deploy.

Deploy your new blog!!

https://hexo.io/docs/deployment.html

1
2
$ hexo clean
$ hexo deploy

After writting the above command, you can see your new blog on GitHub Pages.
http://******.github.io/

Change your blog theme

https://github.com/hexojs/hexo/wiki/Themes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
For instance, How to use the following theme.
https://hexo.io/hexo-theme-light/

## Install it
$ cd [githubaccount].github.io
$ git clone git://github.com/tommy351/hexo-theme-light.git themes/light

## Update the above files
$ themes/light
$ git pull

## Set information to use the theme
$ cd [githubaccount].github.io
$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: light

Create a new page file

https://hexo.io/docs/writing.html

1
2
3
4
5
6
$ hexo new page aboutme
INFO Created: ~/***/yt8yt.github.io/source/aboutme/index.md

$ cd source/aboutme/

$ vi index.md

Use “Read More”

Write <!-- more --> in your articles. <-Only For Certain Themes

Use Plugins

https://github.com/hexojs/hexo/wiki/Plugins

Quick Start

Short Cuts

hexo g == hexo generate

hexo d == hexo deploy

hexo s == hexo server

hexo n == hexo new

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Refresh your blog

Short Cuts

1
$ hexo clean && hexo g && hexo d

Reference

Useful Commands
Documentation Site
Troubleshooting Site
SetUp process

Getting your SSH key


Forked from useHexo.md