Hexo Commands I Actually Need

Hexo has many plugins, themes, and configuration options. The daily workflow is much less dramatic.

Start a new site

1
2
3
npx hexo init my-blog
cd my-blog
npm install

Create a post

1
npx hexo new post "My Post"

Run locally

1
npx hexo server

The default local URL is http://localhost:4000.

Generate static files

1
2
npx hexo clean
npx hexo generate

clean removes generated output and cache. It is useful when stale files appear, but it is not mandatory before every build.

Deploy

1
npx hexo deploy

Deployment requires a configured deployer such as hexo-deployer-git. Generate and deploy can be combined:

1
npx hexo generate --deploy

Use local project binaries through npx or package scripts instead of depending on an unrelated global Hexo version. “Works on my machine” becomes less persuasive when even your machine has three versions installed.

Reference