The One With D
News and commentary on the D Programming Language

Year End Renovations

For quite a while, I've been wanting to change the workflow I use with my personal blogs. The primary motivation is that I'm just tired of Wordpress. I've been eager to make the transition to a purely static site. I've also wanted to scale down my VPS plan, as the one I've been paying for the past couple of years is massively bigger than I need, especially since Linode gave everyone free upgrades a little while back. I finally made the move to the cheaper server a couple of weeks ago and I'm now taking the opportunity to initiate the process of moving over to a static site.

The rest of this post is about what I've done and what I'm going to do as part of the transition, so if that's of no interest to you... Happy New Year! I'll have some news in the coming weeks regarding Derelict and my work on the DUB Handbook. If you're curious about what I'm doing with the blog, read on.

One of the biggest hurdles for me in moving to Linode from shared hosting was learning to administer a server. I had some minor Linux experience, but zero with admin, so I had to rely wholly on tutorials. After a major false start where I managed to spectacularly break the system, I was able to get a Debian 8 instance with Apache 2 reliably up and running. No problems since.

For the new server, I wanted to try something different. Broaden my horizons a bit. All of my Linux experience to this point had been with Debian-based distros (excluding some Red Hat and Suse experiments way back when). And I've never used a web server other than Apache in anger. So for my new static sites, I decided to run CentOS 7 and serve with Nginx. I've learned a thing or two in the past couple of years, and I also picked up a couple of CentOS 7 books to help out, so things went much more smoothly this time. Everything I needed to know about Nginx I gleaned from the documentation. In all, it was a painless process.

Another thing that helped was running CentOS 7 in VMWare on my desktop. I used that as a playground to learn the system before spinning up a new Linode. I usually use Virtual Box, but as part of the expanding my horizons bit, I thought I'd give VMWare a go. I'm liking it better simply because it has a more polished interface.

I've also gotten comfortable with vim over the past few weeks, which is a very big deal for me. I've generally despised it, always preferring nano, but I made the decision to buckle down and learn it. I'm glad I did. I've grokked the basics well enough now that I can fearlessly and efficiently navigate config files through an ssh connection and not cry. I also picked up a couple of books to take me to the next level when I have time to work through them. Interestingly, this has also caused me to learn some standard Windows keyboard shortcuts I had never bothered with, so I'm navigating text more efficiently everywhere now.

Once the server was configured, I decided to archive the old posts. The last time I made a major move, I did a dump of the Wordpress database. It's been sitting on my hard drive ever since. What I wanted this time was a tool that could pull down all the posts and save them as HTML without any intermediate steps. My search led me to HTTrack, which did the job admirably. It adds in some extraneous files and directories, but I extracted only what I needed, configured Nginx so that existing links properly redirect, and uploaded it all here.

The final step was to figure out how to approach publishing new posts. I had experimented with a few static site generators before, so I went back to look at several of them again and a few others I hadn't played with. None of them struck a chord with me. In the end, I settled on a more hand-crafted approach. I pulled down the HTML5 boilerplate stuff, fired up WebStorm and started tweaking. WebStorm is probably overkill, but I do like its code hints for this stuff better than Atom, Sublime Text or VSCode. And, I have a license (been playing with Dart off and on, which I really enjoy), so I might as well use it.

I don't actually want to write my posts in raw HTML. I've been wanting to use Markdown all along. So once I cobbled together an HTML and CSS template I was satisfied with (despite having apparently lost my copy of CSS The Missing Manual in my recent house move), I then knocked up a quick little D program that uses dmarkdown to convert Markdown to HTML. What I love about this is that it only outputs the body. I've tried some tools on both my PC and my Mac that all output full documents, including embedded stylesheets, and was unable to figure out how to configure them to output only the body. At any rate, since I'm coding it, I can customize this little utility (which I'm calling ddown), to output exactly the CSS classes I want, generate XML for the RSS feed, and more. Right now, I'm copying and pasting the output into my new HTML template, but I do plan to enhance ddown to use diet-ng so that I can use Diet templates and eliminate that manual step.

Now that I've gotten this site where I want it to be, I can turn my attention to There's nothing I really want to archive from the existing site, so that step isn't necessary (I've actually already deleted it). All I really need do is create a new stylesheet on top of the boilerplate I've got for this site. Then I can look into getting SSL enabled, adding Google+ comments, and a few other little enhancements I want to make.

In all, I'm quite satisfied with the new setup and am looking forward to being more active with both blogs in the coming year. Again, Happy New Year!