Hexo CLI commands¶
Hexo CLI commands are the primary interface for creating, managing, and publishing content within the Hexo static site generator. The hexo command-line tool allows users to generate new posts, manage drafts, and create site pages^[600-developer-blog-hexo-blog-hexo-command.md].
Creating Posts¶
To create a new blog post, the standard command is used^[600-developer-blog-hexo-blog-hexo-command.md].
hexo new post "文章名称"
This command is functionally equivalent to the shorter syntax^[600-developer-blog-hexo-blog-hexo-command.md].
hexo new "文章名称"
Both commands utilize templates located in the scaffolds directory to generate the file^[600-developer-blog-hexo-blog-hexo-command.md].
Drafts Management¶
For work that is not yet ready for publication, Hexo provides a specific workflow for managing drafts^[600-developer-blog-hexo-blog-hexo-command.md].
- Create Draft:
hexo new drafts "文章名称" - Publish Draft:
hexo publish "文章名称"(Moves the draft from the draft folder to the posts folder) - Preview Drafts: To view draft posts during local development, the server must be started with the
--draftsflag^[600-developer-blog-hexo-blog-hexo-command.md].hexo server --drafts
Creating Pages¶
In addition to blog posts, Hexo can generate standalone pages, such as "About" or "Categories" pages^[600-developer-blog-hexo-blog-hexo-command.md].
hexo new page "文章名称"
Executing this command creates a new folder within the source directory. Unlike standard post URLs, these pages generate an index file at the root of the folder name^[600-developer-blog-hexo-blog-hexo-command.md].
* URL Format: http://localhost:4000/"文章名称"/index.html
Related Concepts¶
- Documentation Workflow
- [[Templates]]
Sources¶
^[600-developer-blog-hexo-blog-hexo-command.md]