This morning, I implemented a design change in my website. Instead of a collection of the five (5) most recent posts, the front page (so to speak) is now only the most recent article. In order to support the change, I had to rewrite a custom command that “publishes drafts”. When I was originally setting up this site, I wanted to have the front page be the most recent article instead of a list. At the time, I was over thinking the means of accomplishing this desire. I was duplicating posts and other silly things. Yesterday, while riding my bicycle to work, out-of-the-blue, I realized the solution to my desired implementation.
My first “publish-draft” command moved the draft article from the drafts folder to its post-publishing archival position. After the re-tool of the command, the publish feature moves the “front page” to its proper archival position based on its published time stamp; then, it moves the draft article into the front page position. Simple enough.
The tool-set I use for managing, creating my site is written in Ruby. I
bring this up because I am fairly new to the ruby libraries and often test
ideas out using a command line ruby tool,
irb. Today, I ran into a situation
where the code ran correctly and gave the desired results in
irb, but when I
ran the same code in the publish command, it resulted in errors. I don’t know
why, but I did find another method to achieve my desired results.