90% or more of bloggers should use something simple like WordPress. It is easy to use and easy to set up. I'd go further and say that at least 50% should use a hosted version and not even bother with running their own server.
I Thought This Was A Post About NOT Doing That?
Indeed it is.
What I'm proposing here applies to an elite group of bloggers. Bloggers who have specific needs that make the time and energy required to set up, configure, use and maintain a static file generator pay them back over time.
Make no mistake, if you go this route, you will not enjoy the “Famous Five Minute Installation” of WordPress. Oh no, my friend, you will instead experience the “Infamous Five Units Of Time To Be Named Later Installation.”
Only your personal experience, effort and luck will fill in the time unit blank here. Hours? Days? Weeks? Months? I can't predict.
OK, You've Scared Me
Good. You should be scared. You might just pour your time and energy into a big old hole in the ground only to decide that WordPress WAS the right choice for you after all.
Don't say I didn't warn you.
Now for the reasons you SHOULD use a static file generator.
1) Speed
I definitely don't mean speed for you, the blogger.
I mean speed for your reader.
With WordPress or any other content management system (CMS) the server has to look up every post in a database, grab the relevant bits and apply a template to convert it into HTML, then send that HTML to the reader's browser.
Even though that blog post you wrote 4 years ago hasn't changed, the CMS system still has to go back to the database and apply the template for each reader.
There are caching add-ons to most CMS systems to reduce the frequency to less than 1:1, but it still happens more frequently than necessary.
With a static file generator, you do that look-up and render only when you change something.
At the end of the process you have plain old files.
Web servers like Apache, IIS or nginx are hella good at serving up those files.
2) Reliability
Reliability is what started me down this path.
This blog was living happily as a WordPress blog on Microsoft's Azure WebSites.
It was getting 20-40 visitors a day and all was well.
One day one of my posts was retweeted and around 300 people visited.
Most of those visitors were greeted with a blank white page that explained that WordPress couldn't connect to the MySQL database. Ouch.
After much cursing, I considered a caching approach before deciding that I was done with WordPress.
I actually switched to a Ghost blogging engine site first. Until the Blog-pocalypse.
For me the balance tipped towards a static site.
I love that there is no database to which the web server can fail to connect.
3) Scalability
Scaling to 300 users would seem like a no-brainer, but since the free Azure MySQL database is limited to only a few users, even that small number killed it.
I haven't load tested the new site yet, but I expect this version of the blog would handle many thousands of users with no problem. That's without increasing any resources.
If I suddenly become far more interesting and a flood of people show up, I could easily scale up or out with no problems. No logins, no sessions, no software related scaling issues.
4) Version Control
This is a geeky one.
As a programmer I live by source control. My current favorite is Git.
I love being able to deploy my entire site via Git.
If something is wrong, I can roll the entire site back to the previous version in just a few seconds.
I also have a permanent record of every version of every file in the blog. Every word, every link, every image, every CSS file.
Even though some static site generators like DocPad can be run dynamically on the server, I prefer to be 100% static.
I actually have two Git repositories hosted on BitBucket:
- Source used to generate the site
- Generated static files deployed to the site
I have a hook on my Azure WebSite that is notified by BitBucket whenever I push a new version to the master branch of the static site repo.
Nice.
5) Tools
As I've said most people will be best suited to the tools provided by WordPress or that work with WordPress.
There are web tools, desktop tools, mobile tools, and probably psychic tools for all I know.
For me, however, I like Vim.
This is not a post about Vim, but it is my tool of choice for writing.
I like keeping my hands on the damned keyboard. It's where all the letters are. And numbers.
With a static file generator like DocPad, I can use Vim, Notepad++, TextMate, Eclipse, Visual Studio, Word, or just about anything else to write.
I'm writing this post in Vim and saving it as Markdown text with meta data at the top of the file containing the title, tags, publish date, etc.
I'm using the UltiSnips plugin for Vim to define all the boiler plate bits such as ads, headers, and figure/figcaption tags and auto insert them zip, zing.
DocPad is running in the background updating the static files every time I save a change.
On my second monitor is a webpage that auto-refreshes when it gets the high-sign from DocPad.
It's early days for my DocPad/Static Site Generator blogging experiment, but so far I like it very much, thank you.
I'll stick comments here under tools. Why? Because you will need an external tool if you want comments. I ripped the comments out of my blog a long time ago. Although I do value the random babbling of spam bots from time to time, I don't really want to provide them a forum in which to attempt to reach sentience.
If you want comments, you can use a service/tool like DISQUS.
Should YOU Use A Static Site Generator?
Honestly, the answer is likely no.
If you aren't hosting your WordPress site somewhere that limits the number of database connections to a ridiculously low number, you will probably be fine. You'll enjoy easy blogging, easy theming, and a ton of tools.
If, like me, you find specific reasons static site generation might work for you, then I wish you luck.
I plan to write a series of blog posts on how I set up this site and navigated the murky waters of setting up the tag-cloud and other features that are simple in WordPress, but not so much with DocPad and company.
Hopefully that will help you decide whether or not the effort is worth it for you, and help you to get started if you decide to give it a try.