As I blogged about earlier, Octopress is a great framework for writing blog posts and packs in all the features for writing a code-centric blogs. Of course, it goes without saying that the blog also looks awesome as if designed by a true designer. Some of the nicer things about writing posts is that there are rake tasks that do most of the grunt work:
source/_posts
called 2011-09-29-just-type-the-title-of-the-post-here-in-plain-english.markdown
source/about
, called index.markdown
http://localhost:4000
and starts monitoring the source
folder for any changes. It automatically generates the corresponding HTML/CSS for the Markdown/SASS files respectively.If you have just migrated from a Wordpress blog or have lots of posts under your source/_posts
, the rake task that generates the HTML output can take a very long time (several minutes). Obviously if you are just working on one post, there is no need to wait for the entire site to generate. What you are looking for is the rake isolate[partial_post_name] task.
Using rake isolate
, you can “isolate” only that post you are working on and move all the others to the source/_stash
folder. The partial_post_name
parameter is just some words in the file name for the post. For example, if I want to isolate the post from the earlier example, I would use
rake isolate[plain-english]
This will move all the other posts to source/_stash
and only keep the 2011-09-29-just-type-the-title-of-the-post-here-in-plain-english.markdown
post in source/_posts
. You can also do this while you are running rake preview
. It will just detect a massive change and only regenerate that one post from then on.
When you are ready to publish your site, just run rake integrate and it will pull all the posts from source/_stash
and put them under source/_posts
. Now you can run rake generate and then rake deploy to publish your updated blog.
If these seem like lot of commands to remember, don’t worry, they will become second nature once you do it few times. As a summary, below are all the tasks that we talked about in this post. The description of each task comes from the Rakefile used by Octopress. I just did a rake list -T
to get a dump of all the tasks.