Static Site Generation With Docpad (Part 1)

Introduction

Since this is my first blog entry, I think it makes sense for me to talk about the technology behind it a little. The whole site is statically generated on my Macbook using Docpad, and deployed to Github Pages.

"Going static" seems to be the trend within the coding community, and for good reason. Though static site generators are not at all new, I think a couple development trends have factored into it becoming a popular choice with developers.

  1. Git all the things!
    Maybe it's just me but I really love using Git. It just makes managing my projects so much more sane. Branching, merging, committing, are all now just a natural extension to development that I almost don't even have to think about it anymore. Now that I'm thoroughly accustomed to this kind of workflow, I find myself increasingly frustrated with managing Wordpress blogs. To do any development, I have to maintain at least two different MySQL databases, one for development and one for production. Then you have to repeat everything you did locally on your development box, such as installing plugins, and theme development, just to get your changes into production. With a static site, I can work completely local, commit my statically generated pages into git, and then push them up to my site. One version control source for both code and data.
  2. The rise in laptop development
    Another big contributing factor in the popularity of static sites is that most developers I know work almost exclusively local. They do all their coding on their laptops. There are so many tools that help with this that it makes it so there really is no reason not to anymore. Logging into your live site through an admin interface, in my opinion seems outdated and cumbersome and leaves your site open to potential security exploits. Now that we're all working locally, it's the next logical step to just administer our blogs locally as well.

So, what is Docpad?

Docpad is a static site generator built in NodeJS and Express. What this means is that Docpad gives you a set of tools that lets you code your site using templates and layouts, and all the other things you're used to using for building dynamic sites. The difference is that it will generate all your pages as plain old static HTML pages, out to an output folder that can be served by any web server (including through localhost using Express).

I chose Docpad over other popular choices (Jekyll and Octopress) because it's less complicated to set up - and it's written in Javascript!

In the next post, I will walk you through getting setup with Docpad and publishing to Github Pages


Found this useful?

Edit This Page    You too can edit this page! ... just make your change then submit a pull request!


comments powered by Disqus