Tiny Hack to the Octopress Isolate Command

Category: Creatives, Octopress, for

Firstly: Hello! to new subscriber Paul. <enthusiastic waving> Welcome!!

Nextly: Hi Reader, have you been around Octopress awhile? Know what you’re doing? I added the shortcut path just for you.


The Laughingmaus has been around since 2002 and slowly but surely my build times were raining on my parade. I’m one of those bloggers who has to try out photos and edit and read aloud and edit some more, then get a cup of coffee while my site built so I could begin all over again.

Octopress to the rescue with the isolate/integrate commands. Damned if I could get them to work though. No matter what I tried, my _stash folder remained stubbornly empty.

It took me awhile to figure out that my pain-point was the way that I daintily sort my posts into folders by year.

Solve This Problem

Have a look here: In your Rakefile search for the “isolate” function (mine started on line 169). There is that bad boy:

Dir.glob("#{source_dir}/#{posts_dir}/*.*") do |post|

You see out there just before the “do” command? The original code is asking for the isolate function to move *.* (anyfilename.anyextension). But a directory is not a file in that sense so let’s change the move specification to * which is broader and includes folders.

Dir.glob("#{source_dir}/#{posts_dir}/*") do |post|

And, in case you are curious, “#{posts_dir}/*” tells the isolate function to include everyeverything in the posts_dir folder. And, the posts_dir variable is specified towards the top of your Rakefile. The default is _posts.

Ok, now you’ll need to do this to the “integrate” function too, it’s just a few lines down from isolate in your Rakefile. The original reads:

FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), ...

And you are going to change yours to…?

FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*"), ...

You had probably already seen the pattern, hadn’t you? It’s the same as above and you’re going to change it in the same way to achieve the same effect: the moving of directories as well as files back into your posts_dir (_posts) when you are finished.

And finally, the only trick to this is that you should keep your recent posts in the _posts directory and wait to file them in the year directory until you are relatively sure you won’t be editing them anymore. The reason for this is that the command above can only move an entire folder. It doesn’t search the folder and move the file it finds out for editing.

Octopress for Creatives

Is a long ignored section of this blog. I hope to change that this summer. Please tweet me (@laughingmaus] or send me a mail if you are a creative with enough technical knowledge to think it might be interesting and fun to walk away from Wordpress and Co. Knowing that a real human being is waiting does shift priorities.

What Everybody Knows, Someone Had To Say

If you are reading about software hacks on my blog, it is not illogical for me to mention that: The * symbol is a basic regular expression and retains its meaning of “every-everything” all over the command line. So, if you’re a newbie to tech matters, and you might well be if you are still reading, I’ll add this friendly warning that back-in-the-day I was very grateful to have been given in advance: Think long and hard before using * with the rm command.

And ok, now you might be thinking that * gone wrong can rain embarrassment down on your head and you’d be right. But that’s what it’s all about, and I hope you won’t even think about slowing down over a little embarrassment. Just keep on experimenting and testing your limits and the limits of your tools and the next thing you know the moment is gone and forgotten - and you, brave reader, are permanently smarter.

« Kelly Writers House TV - Brunch with TC Boyle Film: I Am Not Scared »

Comments