hexo commands

title: Commands

init

1
$ hexo init [folder]

Initializes a website. If no folder is provided, Hexo will set up the website in the current directory.

new

1
$ hexo new [layout] <title>

Creates a new article. If no layout is provided, Hexo will use the default_layout from _config.yml. If the title contains spaces, surround it with quotation marks.

generate

1
$ hexo generate

Generates static files.

Option Description
-d, --deploy Deploy after generation finishes
-w, --watch Watch file changes
-b, --bail Raise an error if any unhandled exception is thrown during generation
-f, --force Force regenerate

publish

1
$ hexo publish [layout] <filename>

Publishes a draft.

delete

直接删除source/_post 内对应的 .md 文章即可

server

1
$ hexo server

Starts a local server. By default, this is at http://localhost:4000/.

Option Description
-p, --port Override default port
-s, --static Only serve static files
-l, --log Enable logger. Override logger format.

deploy

1
$ hexo deploy

Deploys your website.

Option Description
-g, --generate Generate before deployment

render

1
$ hexo render <file1> [file2] ...

Renders files.

Option Description
-o, --output Output destination

migrate

1
$ hexo migrate <type>

Migrates content from other blog systems.

clean

1
$ hexo clean

Cleans the cache file (db.json) and generated files (public).

list

1
$ hexo list <type>

Lists all routes.

version

1
$ hexo version

Displays version information.

Options

Safe mode

1
$ hexo --safe

Disables loading plugins and scripts. Try this if you encounter problems after installing a new plugin.

Debug mode

1
$ hexo --debug

Logs verbose messages to the terminal and to debug.log. Try this if you encounter any problems with Hexo. If you see errors, please raise a GitHub issue.

Silent mode

1
$ hexo --silent

Silences output to the terminal.

Customize config file path

1
$ hexo --config custom.yml

Uses a custom config file (instead of _config.yml). Also accepts a comma-separated list (no spaces) of JSON or YAML config files that will combine the files into a single _multiconfig.yml.

1
$ hexo --config custom.yml,custom2.json

Display drafts

1
$ hexo --draft

Displays draft posts (stored in the source/_drafts folder).

Customize CWD

1
$ hexo --cwd /path/to/cwd

Customizes the path of current working directory.