Display draft post

2021-02-19 14:25 hexo

To view the draft posts (in the source\_drafts folder) on localhost:4000, just run hexo server --draft. Set render_drafts as true in _config.yml will make hexo generate generate the posts in source\_drafts into public folder, which means the draft posts will be deployed to GitHub page by hexo deploy. No needs to set render_drafts as true to view the draft posts on localhost, running hexo server --draft is enough.

_config.yml中的render_drafts設定為true的話,執行hexo generate時,資料夾source\_drafts內的檔案也會被生成到public資料夾中。 在這個情況下執行hexo deploy就會把草稿文章推到 GitHub Page 上。

只是想要在 localhost:4000 上瀏覽草稿的話,執行hexo server --draft即可,不用修改render_drafts的值。 hexo 官方文件對render_drafts的說明比較簡短,一開始以為設定成true只是代表hexo server會渲染草稿……😇

Environment

hexo: 5.3.0
hexo-cli: 4.2.0
os: Windows_NT 10.0.18363 win32 x64

Reference