hexo is a static blog platform based on Nodejs by tommy351, using Markdown (or other engine) to parse post, and the most exciting point is its fast enough as to parse hundreds of posts with seconds. After using ghost for several months, I decided to move my blog from ghost to hexo.


目录

  1. Getting Started With Hexo
    1. Init a project
    2. Generate Static Web Pages
    3. Create New Post/Page
    4. Deploy Your Blog
    5. Publish Your Draft
    6. Clean Existed Files
    7. Run Hexo Server
    8. Render Your Blog
    9. Other Commands
    10. Composite Command
  2. Developing Your Hexo
    1. Basic Configuration
    2. Deploy Config
  3. Tuning Your Hexo
    1. Themes
    2. Plugins

Before installing hexo, one needs to install nodejs and npm, which could be downloaded and installed from the official site nodejs. And be sure that git is installed as well

1
sudo npm install -g hexo-cli hexo-server

Getting Started With Hexo

Hexo is easy to use, and most commands have abbreviation, like:

1
hexo generate

is equivalent to

1
hexo g

In the following, we use the convention to include full command ant its abbr.

1
hexo g[enerate]

Init a project

1
2
hexo init [folder]
cd [folder] && nam install

If no [folder], hexo will initialize the current directory.

Generate Static Web Pages

1
hexo g[enerate]

Create New Post/Page

1
2
hexo n[ew] "title"
hexo n[ew] page "title"

Deploy Your Blog

1
hexo d[eploy]

Here one needs to have the project properly configured.

Publish Your Draft

1
hexo p[ublish] 'draft' post/page

Clean Existed Files

1
hexo c[lean]

Run Hexo Server

Run a hexo server to publish your site:

1
hexo s[erver]

Render Your Blog

1
hexo render

Other Commands

1
2
hexo help
hexo version

Composite Command

Several commands can be combined,

1
2
hexo d[eploy] -g # create and deploy
hexo s[erver] -g # create and preview

Developing Your Hexo

Basic Configuration

Noting that there is a space after the colon followed by each option, like

1
2
3
4
### right configuration
aaa: bbb
### wrong configuration
aaa:bbb

Some basic options are followed below,

1
2
3
4
5
6
7
title: dark
subtitle: darkshell
description: a simple static blog
author: dark
language: en

url: http://yoursite.com

Deploy Config

One can easily deploy hexo project to github pages via git, or your personal server.

1
2
3
type: git
repository: git@github.com/darkshell/darkshell.io.git
branch: master

Tuning Your Hexo

Themes

hexo project 上有许多非常棒的主题, 下面是个人觉得很棒的主题.

Plugins

http://hexo.io/plugins 上有很多插件, 可以按需安装.

1
2
3
npm install hexo-render-ejs --save
npm install hexo-render-stylus --save
npm install hexo-render-marked --save

水水更健康 O(∩_∩)O~