hexo cheatsheet

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Cheatsheet

Installation

1
2
3
npm install hexo -g #install
npm update hexo -g #update
hexo init #initialize

Shorthands

1
2
3
4
5
6
7
8
hexo n #hexo new
hexo p #hexo publish
hexo g #hexo generate
hexo s #hexo server
hexo d #hexo deploy

hexo s -g #hexo server with generator
hexo s -g --draft #hexo server with generator and show drafts

Server

1
2
3
4
5
6
7
hexo server #Hexo will watch files, don't need to restart server 
hexo server -s #Static mode, serve public folder and disable file watching.
hexo server -p 5000 #change port
hexo server -i 192.168.1.1 #custom ip
hexo clean #Cleans the cache file (db.json) and generated files (public).
hexo g #Generates static files.
hexo d #Deploys your website.

Watching

1
2
hexo generate
hexo generate --watch #Watch file changes

Deploy

1
2
3
4
5
hexo generate --deploy
hexo deploy --generate

hexo deploy -g
hexo server -g

Posts

1
2
3
4
5
6
7
8
9
10
11
hexo new "postName" # new post _posts/postName.md
hexo new page "pageName"
hexo generate
hexo server
hexo deploy #.deploy deploy to GitHub repo
hexo new [layout] <title>
hexo new photo "My Gallery"
hexo new "Hello World" --lang tw

hexo new draft "New Draft" # New-Draft.md
hexo publish "New Draft" # copy New-Draft.md from _drafts to _posts

Quick Start

Command line reference: Commands | Hexo

Installation with github: How to use Hexo and deploy to GitHub Pages

Next theme: Hexo搭建GitHub博客(三)- NexT主题配置使用 | Zhiho’s Blog

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