概述:Hexo 使用草稿箱

创建草稿

创建草稿需要使用 draft 布局,例如:

1
2
$ hexo new draft "Draft Demo"
INFO Created: ~/VScode/blog/source/_drafts/Draft-Demo.md

预览草稿

默认情况下,草稿不会显示在页面中,如果想要显示可以在站点配置文件 _config.yml 中把 render_drafts 参数设为 true 来预览草稿。

1
render_drafts: true

或者在启动服务器时加上 --draft 参数来预览草稿

1
hexo server --draft

发布草稿

将草稿文件发布到 _posts 文件夹下

1
hexo publish [layout] <title>

例如:

1
2
$ hexo publish post Draft-Demo
INFO Published: ~/VScode/blog/source/_posts/Draft-Demo.md