A static site generator in three days
I started work on SlenderSite on a whim, for lack of something better to do. Being tired and cranky, on the first day I only wrote 25 lines of code. Turns out, that’s already enough to make a working, if trivial, SSG!
Didn’t feel much better the next day, but creativity has a way of picking up steam. Adding automatic site navigation took rather more code: 40 lines. It’s an important feature though; a big part of what makes tools like this useful in the first place.
It’s the third day of tinkering with my new toy, and blog posts are next. They’re a bonus, to be honest, but still good to have even on a site not focused on blogging. Besides, seeing how little code it took so far, it would be a shame not to add this popular feature. Turns out, the tricky part is how to sneak a list of recent blog posts onto a page. It would be easy if I could assume Markdown for page content, but I don’t want to.
Anyway, one reason I’ve been coding so slowly (apart from taking it easy and having fun) is my decision to write the sample site along the way. That gives me something to work with, but also a head start on project documentation, and a way to structure my ideas before the code ossifies.
Oh, right: did I mention cramming a useful stylesheet in five lines of CSS? Not quite a new personal record, but almost.
P.S. In the end, the correct solution for posts was to allow per-page templates. It’s useful in many other situations, anyway.