Drew Strickland Menu

Blogging with Docpad

Blogging is a great form of expression, entertaining, and dispersion of information. Personally, I would encourage anyone with fresh ideas or a new take on old-hat to start telling other people all about it. More importantly, blogging couldn't be easier. There is simply a plethora of blogging software available, and most of it could not be easier. Just about anyone with an internet connection has access to Tumblr for free, and most of them could also spin up a Wordpress site with next to no work.

For web developers, this becomes a bit of a challenge. Using a blogging platform almost becomes an endorsement of that stack or solution, which can, and might, reflect on your abilities, decision making process, and preferences as a software engineer. With that in mind, the field really opens up. Do you spin up a Ghost blog to reflect your affinity for NodeJS? How about wrangling and abusing Joomla into being a blog engine? Concrete5? At one point, my personal blog ran on Tumblr, but since I didn't want to get asked Tumblr questions in interviews, I fronted it with a web app and brought the content in via Tumblr's API.

What's the best solution?

There is no "best" solution. There's stuff that works for you, and stuff that works better for others. Sure, some solutions focus on the core problem more than others. The core problem is simple: get written content on a page, organized in a logical fashion, in any easy to consume, easy to edit format. After you get the core problem solved, then you can focus on more features, which for blogs are pretty simple. At it's core, a blog is nothing more than:

  • A Content Editor
  • Pages for Content
  • A Listing of Posts
  • Comments on Posts
  • A Layout Engine to tie all that together

Realistically, a blog doesn't need a database, it doesn't need an editor online (making the editor be offline might actually be more secure), it doesn't have to have a photo uploader or fancy editorial approval process, and it doesn't have to render dynamically every single time (in fact, it shouldn't). A blog could be as simple as a static site. The less moving parts there are, the easier it is to maintain, and the less likely it is to break.

Why use a static site for my blog?

There are 3 big reasons why static sites make ideal blogs:

  1. It's more secure - In a static site, you only have to worry about securing the server. There's no database to worry about, and there's no admin section to lock down. There are simply fewer points of ingress.
  2. It's faster - Most blog engines offer, or use by default, a cache. The idea of a cache is to pre-render the content to speed up serving content by skipping the dynamic rendering when the content hasn't changed. In short, blogging engines want to use static pages when and where they can. By skipping the dynamic rendering all together, or more accurately, moving that process somewhere else, your blog gets faster.
  3. It's cheaper (probably) - Ditching the database means no database server. Having no application code means no app server. That makes your site run well on even the leanest of servers. Did you know, anyone with a free GitHub account can host a static site for free? While it's cheap or free to run a Wordpress installation, it's always cheaper (or free-er) to run a static site.

Why use Docpad?

For me, it's personal preference. I ♥ Docpad. Docpad is a great tool for building static sites, but it can also be used to blog, with just a little work. In fact, I have recently added a new skeleton to Docpad which allows you to quickly create a blog with a look and feel similar to Casper, the default theme of Ghost. If you don't already have Docpad, simply follow this installation guide and then initialize a new docpad project:

mkdir my-blog
cd my-blog
docpad run --skeleton casper

Since my work on this skeleton is based entirely on Open Source projects, feel free to pop it open and hack it up. I provided this skeleton as a simple way for people to start using Docpad for blogging. I recommend it and I do it myself. In fact, everything you are reading right now is being presented in a static-site-based-blog using Docpad.

What about comments?

Disqus is a very nifty solution to having comments without having to manage the data. Disqus manages comments and ties them to a url, and only requires the addition of one <div> and a couple script tags. For those of you paying attention, you'll not this is how I do comments, Tumblr does comments, and some installations of Wordpress do comments. Frankly, making comments someone else's problem really simplifies the entire concept of a blog.

comments powered by Disqus