WordPress as a static website generator


I’ve been blogging for 5 years now. This site is something like my 3rd or 4th attempt at having a blog that actually was maintained and did not die in a few months. It’s been hard work. The whole first year I wrote every day, just to get into the habit and it payed off. I often get job offers and meet interesting people through my writings.

When I first started my choice was to use Tumblr, because at the moment it seemed like if I used something very simple it would be easier to maintain and it would help me keep my interest. For the most part it worked. The first years I did a lot of posts and kept the momentum going. Tumblr allowed me to publish little pieces of content that kept the blog active and in the top of my mind.

After a few incidents with the Tumblr service (they where down for a few days) I decided that elweb was mature enough to get a makeover and also it’s own hosting. I was already paying for a VPS that wasn’t getting a lot of use so it was perfect. This blog became a WordPress site and it got a new look courtesy of the iA Template for WordPress. I really love that template. The only bad thing about it was that every few days someone accused me of stealing their design. That’s not a good thing if you earn a living designing websites.

After a while on WordPress, the site started feeling a little slow and Jekyll and Octopress where the cool new kids on the block. The idea of having my site hosted as static files seemed great so I gave Jekyll a try. After a few hours of playing, it seemed that the transition would be very complicated. I had hundreds of blog posts that needed to be converted to markdown and also I had to figure out how to do forwards for all the old urls. I gave up.

Then I tried Octopress just to confirm that I was not giving up too easy and I have to say that it looks a lot better out of the box. It has everything I want except a custom template. So the idea was to hack a very simple template, just like the one this site uses now and maybe take advantage of some of the cool plugins Octopress has. Turns out it’s a lot harder that I thought. After spending a whole day trying to get to a point where I could actually understand how to implement a custom theme I was really frustrated and decided that maybe I was not beign successful because I was using a Ruby tool and I’m not a Ruby expert. So the next idea was to try something made in Python.

I found Pelican, a static site generator written in Python and using a lot of the ideas I’m used to. Again after a few hours I was frustrated and tired, so I gave up.

This “cool idea” was taking me too much time. This is just a blog not my job.

Frustrated with my failed attempts I decided just to try to optimize my WordPress site. I did a lot of research and learned a lot about WordPress optimization but the one thing that changed everything was a very cool plugin called WP Super Cache. I also tried W3 Total Cache which seems to be a lot more popular and polished but it’s just not as good. WP Super Cache FTW!

This plugin is great. Basically it generates static versions of all your pages on demand and from that point on it serves the static version instead of hitting the database or even the PHP scripts. You can even integrate with Amazon S3 and Cloud Front so you get CDN distribution of your site with just a few clicks.

My site has been featured on reddit and on Hacker News a few times and it has received tens of thousands of visits in a few minutes without failing or even slowing down.

This setup made me so confident that I moved my site from the VPS to the cheapest plan that Dreamhost offers and with this plugin installed the site is just as fast. The only down side is that the admin part of WordPress is super slow because I’m hosting on a shared server. My solution for this is that I do all of my writing on Evernote and just copy paste when I’m done.

The only thing that I have to do differently is that when a post is published I just click on the Delete cache button that appears on my toolbar and that’s it. The site re-generates all pages and the site becomes super fast again.

The plugin has many options you can tweak if you are into that. But for me I just delete the cache every time I publish a new post and that’s it, no preloading or garbage collection.

So there you have it. Just install the WP Super Cache plugin and you can make your WordPress site behave like a static site from one of the popular generators out there.

The difference is that you also get to use any of thousands of WordPress plugins and themes available, an easy to understand interface that works great with non-technical collaborators and best of all, making custom themes for WordPress is super easy.