Blogging on Middleman

December 31, 2016 – tagged as blog, ruby, middleman, web, framework

Middleman logo

I recently moved this site to Middleman from WordPress. Middleman is a static site engine, which means you do fancy stuff on your laptop, run a build script, and get a ready-to-deploy folder with nothing by html, js, and css that can be served statically by a web server. I’m loving the freedom of having a full Ruby-based framework without the overhead of maintaing a multi-component, database-driven site. I was initially looking at using Jekyll, but Middleman seemed to offer a bit more flexibiliy, namely in template engines. There are several other interesting options, e.g., Hugo, but Ruby is familiar and Middleman lets me do some Rails-like stuff.

Impressions

It’s only been a few days using it, but here are my first impressions.

Good

  • flexibility - as noted, templates are what sold me. Middleman lets you use Ruby erb template, which means you can do anything anywhere. This could be bad I suppose if security was a concern, but for me it just means I can do anything I can dream of in Ruby.
  • active - the community seems active. Jekyll seems to be the most popular static blog system, but Middleman appears to have an active community behind it.
  • Rails-like - my real alternative was to build a Rails app. If I spent any real time on my blog, I’d probably go this route. As I don’t manage my blog daily, keeping a production server up and running felt a bit heavy. Middleman gives me the much of the power I’d have with Rails on my end, but keeps things simple and static on the server.

Ok

  • buggy on the fringes - I changed a few of the defaults while toying around and found that things that should just work were broken in some cases, e.g., using RedCarpet instead of kramdown for markdown support created Tilt issues.
  • weak error messages - When you do something wrong, Middleman doesn’t tell you much. Cryptic errors do not point back to the source where they occurred. I think someone new to Ruby might have a bit of difficulty troubleshooting.

Bad

The one major downside of going static is comments aren’t easily supported. This is a general challenge with any static setup and not specific to Middleman. There a few solutions out there, but they all have some “gotcha” in my opinion. As my comment volume is low, I ended up doing the following:

  1. If someone wants to comment, they email me. Yep, that’s right. Good ol’ fashioned email. I figure this will help keep comments to people who really have something to say.
  2. I manually put the comment into a local sqlite database. It’s like a glorified Excel sheet that Middleman can access.
  3. In my template, I query the local database and generate static comments.

The thing I like about this is that it’s minimally dynamic, and sqlite doesn’t require a running database server, i.e., it’s just a single text file that I update.

Comments

Email mark@markmcb.com with questions, comments, or links to external discussions.
Privacy Note: I will not post your email address in the comments unless you request it.

No comments yet. Be the first!