Pete Keen

Blog Generator Updates

I've made some small changes to the way bugsplat.info is generated. First, I refactored publish.pl quite extensively. Instead of being a huge mess of spaghetti-perl, it's nicely factored out into functions, each one doing as little as possible. It got a little longer, but I think it's worth the tradeoff in readability.

Second, I added self-generated shortlinks. Each post on the site has an internal id, which is actually a monotonically increasing sequence number. The short link for a post is http://bugsplat.info/<id>. For this post, it's http://bugsplat.info/13. These are implemented as mod_rewrite rules in .htaccess which are generated using a template, just like every other piece of content on the site.

Third, I wrote a new convenience script named next-entry.pl, the idea for which I shamelessly stole from technosorcery. Basically, it'll prompt me for a post title using bash's read function, then generate a URL and some date strings, as well as comb through the entries/ directory to find the highest id, then increase it by one. It writes all this to a file and then opens emacsclient right at the correct spot to start typing an entry.

Fourth, I worked on the CSS a little bit. Hopefully it looks a little snazzier than it did before.

Share:        Y 

Other Formats:  Download PDF Download Raw Markdown

6 Aug 2010   Tagged: Programming  Meta 

Related Posts