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.

OptionDescription
-p, --pathArticle path. Customize the article’s path.
-r, --replaceReplace the current article if it exists.
-s, --slugArticle 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.

OptionDescription
-d, --deployDeploy after generation is complete.
-w, --watchWatch for file changes
-b, --bailRaise an exception if any unhandled exception occurs during generation
-f, --forceForce regeneration
-c, --concurrencyMaximum 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/.

OptionDescription
-p, --portOverride the default port
-s, --staticOnly serve static files
-l, --logEnable 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.

Hexo's Basic Commands

Author

Shayne Wong

Publish Date

10 - 09 - 2025

License

Shayne Wong

Avatar
Shayne Wong

All time is no time when it is past.