The past couple of days I have bene working on migrating my Drupal-powered blog to a Middleman-generated static website, as well as giving my blog a facelift, a responsive layout and other goodies. So, what is wrong with Drupal?
Static Site Generator Benefits
Nothing is wrong with Drupal, really. It is still a good CMS, and I still use it for professional consulting work. For my blog, however, I think that a static site generator like Middleman makes more sense and comes with quite a few desirable features:
- No more security patches to install. Every time seeing the red warnings that some module needs to be patched when I sign into the admin makes me nervous. Long gone are the days having to constantly keeping up-to-date. Yes, even with Drush, it is still a pain.
- Site is lean, has clean markup and is easy to maintain. Styling a CMS is always very time consuming. Not only does Drupal come with its own stylesheets that you cannot easily get rid of, but you also have to deal with complex auto-generated markups. Being able to write my own markups, choose the UI frameworks I like and organize things however I want is completely awesome. I can easily implement responsive design using Bootstrap, without having to override Drupal’s styles.
For me these are strong reasons that motivated the migration.
Difficulties with Middleman
Middleman certainly comes with its issues. Below are the things I encountered during the migration:
- Lots of dependencies to install. In order to support many languages and features, Middleman comes with a long list of gems that need to be installed. Some dependencies, like ExecJS, even require native C extensions to be built, which in turn require more dependencies. I had a bit of trouble trying to build V8 on my slightly antiquated RHEL5 box and took a while to sort out the trouble. There are also other cross-language dependencies, like Pygments, which required additional libraries to be installed. Drupal on the other hand usually does not require additional software to be installed in order to work.
- Configuring Pygments was not very strightforward. Unlike Jekyll, Middleman does not have a good official documentation about how one can configure Pygments and the GitHub-flavoured markdown. It took me a bit of Goolging, trial and error to get it to work the way I like.
- Middleman blog gem feels like it has lots of room for improvement. The generated template was quite lacking. For example, I would like to have a pagination with page numbers listed. I would like to have tags to be sorted by the number of posts and by alphabets. The markup could also use a bit of refactoring. I would like to use periods (.) in the URL, but this does not seem to be possible at the moment. Fortunately, static site generators are tailored towrads developers for a reason.
middleman servercrashed a few times. This happened mostly during making significant changes to eRuby layout files and introducing Ruby syntax errors. Since I am a Ruby beginner, I can’t really blame Middleman for this, but this was a challenge for me nonetheless.
To build this site, I used to following gems/frameworks/libraries/platforms:
- Middleman with middleman-blog and middleman-syntax.
- Pygments syntax highlighting through redcarpet2 and pygments.rb.
- Sass and Compass for CSS and GitHub-Flavoured Markdown for page content.
- Typekit for the Myriad Pro fonts.
- Twitter Bootstrap for responsive grid layout and CSS goodies.
Font AwesomeEntypo, IcoMoon and IcoMoon App for the icons.
- IntelliJ and vim for building and writing everything.
- git for source control and GitHub for hosting of source repository.
- Jenkins for continuous delivery.
- Disqus for commenting. Without it, commenting would not be possible for a static website.
- mod_rewrite to map old URLs to new ones.
I have to say using an IDE or vim to write blog posts is an absolutely pleasant experience. I don’t have to deal with issues inherent to the web interface and I can update my website very efficiently. Oh, and, as much as I like to use gist, syntax highlighting now works wonderfully. I don’t have to throw everything up onto gist now. I also don’t have to deal with the trouble of having to constantly update my blog software.
Although I will still use Drupal, as clients can’t, well, use git and Markdown. I do intend to explore the possibility to use static site generators for more static sites, that do not require dynamic client to be entered by clients. The challenge will be, however, the need to develop a simple workflow for designers to be able to update a site created with a static site generator. If that can be solved, then I will for sure see more uses of static site generators elsewhere.
With the awesome static site generator, more blog posts will keep coming.
: I uninstalled four copies of Eclipse for good and freed up 2 GB of disk space from my SSD. More details about this story will come in a future post.