Hexo Tips

编辑引用

1
2
3
{% blockquote Seth Godin http://sethgodin.typepad.com/seths_blog/2009/07/welcome-to-island-marketing.html Welcome to Island Marketing %}
Every interaction is both precious and an opportunity to delight.
{% endblockquote %}

Every interaction is both precious and an opportunity to delight.

常见命令

Hexo 常见命令 (hexo.io)


Next主题常见设置

Installation

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

Shorthands

script
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

script
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

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

Deploy

script
1
2
3
4
5
6

hexo generate --deploy
hexo deploy --generate

hexo deploy -g
hexo server -g

Post

script
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

start Server

script
1
hexo s

new page

script
1
$ hexo new page "page name"

new post

script
1
2
3
4
5
// new post
$ hexo new "post name"

hexo new [layout] <title>
<!-- Layout: draft/post/

new draft

script
1
$ hexo new draft "new draft"

publish draft

script
1
$ hexo publish [layout] <filename>

show draft in server

script
1
$ hexo server --draft

force show draft

script
1
2
/<><_config.yml(root)>
render_drafts: true

<_config.yml> File Configuration

1. Hexo -> _config.yml

Set up gitHub SSH