Basic Commands
init
$ hexo init [folder]
Create a new website. If folder is not specified, Hexo will create the website in the current directory by default.
This command essentially performs the following steps:
1️⃣ Git clone hexo-starter and the hexo-theme-landscape theme to the current directory or specified directory.
2️⃣ Download dependencies using Yarn 1, pnpm, or npm package manager (if multiple are installed, the one listed first takes priority). npm is installed by default with Node.js.
new
$ hexo new [layout] <title>
Create a new article. If layout is not specified, the default_layout parameter in _config.yml will be used by default. Use the draft layout to create drafts. If the title contains spaces, please enclose it in quotation marks.
| Option | Description |
|---|---|
-p, --path | Article path. Customize the article’s path. |
-r, --replace | Replace the current article if it exists. |
-s, --slug | Article alias. Customize the article’s URL. |
PS: By default, Hexo uses the article’s title to determine the file path. For standalone pages, Hexo creates a directory named after the title and places an index.md file within it. You can use the --path parameter to override this behavior and determine the file directory yourself:
hexo new page --path about/me "About me"
The above command will create a source/about/me.md file, with the title in the Front Matter set to “About me”
Note! The title must be specified!
generate
$ hexo generate or $ hexo g
Generate static files.
| Option | Description |
|---|---|
-d, --deploy | Deploy after generation is complete. |
-w, --watch | Watch for file changes |
-b, --bail | Raise an exception if any unhandled exception occurs during generation |
-f, --force | Force regeneration |
-c, --concurrency | Maximum number of files to be generated simultaneously. Defaults to unlimited |
server
$ hexo server or $ hexo s
Start the server. By default, the access address is: http://localhost:4000/.
| Option | Description |
|---|---|
-p, --port | Override the default port |
-s, --static | Only serve static files |
-l, --log | Enable logging. Override logger format. |
General Update Process — The Three-Step Routine
hexo cl -> hexo g -> hexo d
If you wanna get it more simpler, try hexo cl && hexo d -g or just hexo d -g. Under most situations, it won’t make any errors.