hexo 常用命令

本文最后更新于:22 分钟前

环境检查与初始化


hexo version # 查看 Hexo / Node / npm 版本
hexo init


本地开发


hexo generate 或 hexo g # 生成静态文件到 public
hexo server 或 hexo s # 启动本地服务器,默认 http://localhost:4000
hexo clean && hexo g && hexo s # 一键「清缓存+生成+预览」

常用可选参数
hexo s -p 5000 # 改端口
hexo s -l # 静默日志
hexo g -w # watch 模式,改文件自动重新生成


写作与草稿


hexo new post “标题” # 新建文章,文件在 source/_posts
hexo new draft “标题” # 新建草稿,文件在 source/_drafts
hexo publish draft “标题” # 把草稿正式发布到 _posts
hexo new page “about” # 新建独立页面,会生成 source/about/index.md