Using Hexo to Build Your Personal Static Blog
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.
目录
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
sudo npm install -g hexo-cli hexo-server
Getting Started With Hexo
Hexo is easy to use, and most commands have abbreviation, like:
hexo generate
is equivalent to
hexo g
In the following, we use the convention to include full command ant its abbr.
hexo g[enerate]
Init a project
hexo init [folder]
cd [folder] && nam install
If no [folder]
, hexo will initialize the current directory.
Generate Static Web Pages
hexo g[enerate]
Create New Post/Page
hexo n[ew] "title"
hexo n[ew] page "title"
Deploy Your Blog
hexo d[eploy]
Here one needs to have the project properly configured.
Publish Your Draft
hexo p[ublish] 'draft' post/page
Clean Existed Files
hexo c[lean]
Run Hexo Server
Run a hexo server to publish your site:
hexo s[erver]
Render Your Blog
hexo render
Other Commands
hexo help
hexo version
Composite Command
Several commands can be combined,
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
### right configuration
aaa: bbb
### wrong configuration
aaa:bbb
Some basic options are followed below,
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.
type: git
repository: git@github.com/darkshell/darkshell.io.git
branch: master
Tuning Your Hexo
Themes
hexo project 上有许多非常棒的主题, 下面是个人觉得很棒的主题.
- Alberta
- Casper – The Ghost Casper theme ported to Hexo.
- Transparent – A transparent theme based on Light.
- Vno – The Ghost Vno theme ported to Hexo.
- Tranquilpeark – a good hexo theme
Plugins
http://hexo.io/plugins 上有很多插件, 可以按需安装.
npm install hexo-render-ejs --save
npm install hexo-render-stylus --save
npm install hexo-render-marked --save
水水更健康 O(∩_∩)O~


