Draft - New Octopress Feature
In new Octopress version 3 is some new useful features. One of the is Draft. At least I was not using anything like that before. When I started to write my first post for new Octopress, I wanted to write another very short post before finishing my first much larger post. Later I realised that I should’ve used this draft feature along with publish
and unpublish
commands.
So decided to experiment with this feature and created this new post first as a draft.
octopress new draft "Draft - new Octopress feature"
open _drafts/draft-new-octopress-feature.markdown
(edit the draft)
octopress publish _drafts/draft-new-octopress-feature.markdown
Published: _drafts/draft-new-octopress-feature.markdown → _posts/2015-07-15-draft-new-octopress-feature.markdown
git add .
git commit -m "adding new post"
git push origin source
jekyll build
octopress deploy
- Create a draft. Octopress creates new draft from template in
_drafts
directory. - Open newly created draft for editing.
- Edit the draft.
- When draft is ready, publish it .
- Octopress moves draft into
_posts
directory and adds timestamp to the post file name. - Add new files to
git
. - Commit changes.
- Build the blog.
- Deploy update project.
Post can be converted into draft with unpublish
command:
octopress unpublish _posts/2015-07-15-draft-new-octopress-feature.markdown
Unpublished: _posts/2015-07-15-draft-new-octopress-feature.markdown → _drafts/draft-new-octopress-feature.markdown
Octopress renames the post by removing timestamp from the name and moves file from _posts
directory to _drafts
.
This is very useful when writing long post or when the post writing is interruped otherwise. Work still can be committed and pushed to git without publishing the post yet.
Unfortunately there is no direct way to test the draft locally. Only way to test the draft is to publish it, test and then unpublish again to continue work on it.