So, just in time for the new year, I’ve finally gotten this site up and running. It runs on Octopress, which is a framework on top of Jekyll to better support blogging, and I’m hoping to be doing a fair bit of that.
My current set-up is slightly messy, as I’m on a windows PC running a Ruby app, but it works surprisingly well (better than most languages/frameworks that come to Windows as an after-thought). At the very least, setting up this has convinced me to learn Ruby as my next language.
So the website you’re currently reading is completely static, generated on my machine then uploaded to my server (I could have hosted the entire thing on the server and added a post-commit hook to regenerate the site but I quite like the clean-ness of having just the site on the server) and I think I like it. It solves one of the largest issues with database-backed sites for me, and ends up with a really light-weight site that should be pretty difficult to take offline through traffic or hack (not that either of those are that likely)
Why A Static Site?
For a good long while my tool for making websites was WordPress, mainly because it was ubiquitous, and basically everyone knows enough PHP to hack around any issues they might encounter (later in my life I would have the misfortune of learning enough PHP that I could truly grasp the horror). But WordPress was always slow and slightly broken and attempting to keep it secure was an exercise in futility. Mostly I hated the editor, which was (and likely still is) one of those web-based faux-WYSIWYG editors that look just enough like a proper editor to trick you in to thinking that your keyboard would behave (as in, tab should insert a tab, not move to the next box, Ctrl-S should save the post, not attempt to save the page). I took to writing up my posts in word and then fixing it up in WordPress after the fact. It was not fun.
Then for a short while I used Ghost, which fixed some of the issues with WordPress, it was faster and leaner and less of a mess, everything animated beautifully, and importantly the editor was a bit better, not quite good enough that I could use it instead of a desktop app, but it was close, and it used Markdown anyway so it was easy to write a post in a decent Markdown editor (I use MarkdownPad 2, it’s lovely) and then copy/paste it over and it should mostly ‘just work’.
I think the thing that annoyed me most about ghost was the lacklustre support for themes, there wasn’t much documentation and none of the example themes I could find really matched what I wanted to do at that time.
So when it came to create this site, I decided to go hunting for a new option (because the xmas break is the perfect time to disappear down a rabbit-hole of web technologies) I wanted something that fit the following criteria:
- Supports using a desktop editor
- Uses Markdown
- Supported blogging well
- Relatively easy to theme
I’d been exposed to Jekyll a bit (through GitHub Pages) and that got the idea in to my head to check out some static website generators, a bit of searching later and I ran across Octopress, which seemed to answer all the above points.
Once I’d gotten set-up with Octopress locally (and got a site generated, woo!) it was time to get tinkering with it. I found a theme I could use as a base (Octopress-flat) and spend far, far too long customising that to be what you see now. I needed something to display my portfolio stuff on the frontpage, so I went looking for plugins and found this one which almost did what I needed though I had some fun altering it so that it grabbed the index.markdown, rendered it in to HTML, then displayed the whole thing below the main image. But now when I want to add a new portfolio item it’s as easy as adding a new blog post.
I tend to link to other blog posts, and whilst Jekyll/Octopress supports this with the post_url tag it causes issues when the atom RSS feed is generated if you use the default Markdown renderer (rdiscount). However other generators are supported, so I switched to kramdown but made it use rouge for the syntax highlighting so that the Octopress CSS would still work (by default kramdown uses Coderay, which doesn’t support C#, and uses a different theme setup, thankfully rouge does support C# and is designed to use themes created for pygments, which is what Octopress uses by default)
To Make A New Post
At the moment, when I want to create a new post, I have to do the following:
- I use a rake command supplied by Octopress to create the relevant Markdown file
- Type up the post in MarkdownPad 2
- Use another rake command to generate the site
- Use WinSCP to sync the site to my server (that last bit is done as a batch file).
Since both the site (and the whole Octopress project) is in a git repo there’s a few ‘commit’ steps mixed in with that lot but it’s a relatively decent work-flow. In the near future I’m going to host the repo somewhere proper and have my CI server take care of generating/uploading the site (although the separate generation step isn’t that useful since I tend to generate it locally to check it anyway, and at that point I might as well just upload it)