Since I created a jekyll based website that will contain all my future postings I started thinking about how I would handle the scenario whereby I would like to write now, but publish later. This capability would allow me to queue up some posts quickly, but spread out the publishing time to make it look like I have been writing on a consistent timeline. While this may be similar to lying, I think that at the very least it would be an intellectual exercise to come up with a capable scheme to accomplish this goal, especially since all the major publishing platforms allow this functionality.
I did consider just using the future setting that is baked into jekyll, however this presented a few limitations and extra work on my part to make it work in a seemless manner (I would have to do needless commits anyway since github only regenerates the site when you push a commit). I figured I might learn some more of the intricacies of git, as well as make something a little bit more flexible.
The overall design is to have two main branches, the master branch which is what github uses as the base for the jekyll build, and the work in progress branch which I keep locally and it holds the ideas I have for future posts. When a post has been fully baked I will pick a date and move it to it’s own branch, which will be named based on the date I pick to publish it.
I created a rake task in my rakefile that simplifies the steps that are required to create the dated branch. This will slurp a file from the wip folder (only available on the wip branch) and create a new branch based on a date that is passed in as an argument.
With the content safely committed to its own branch, I can just wait until the publish date to merge and push. Or I could simplify that to a single command and automate it in a cronjob. To help this along I also created a simple rake task. This will merge in all branches that are older or equal to todays date into the master branch, and then push those changes to the github remote repository.
Using these two rake tasks I am able to have a workflow that works for me.
In addition to this I have also made it easier to preview my work in progress pages by using the site.pages enumeration to see what I have in the pipeline.
I am very happy with this setup for now, and I am sure there will be more tweaks and improvements to it in the future.