Making this site: Going static
I was thrilled with the idea of pivoting my site from a freelancer’s pitch to a developer’s journal. I really wanted to get back to basics. At its heart, the web consists of words and links to more words. Your browser sends a request for a page; my server sends a page back to you.
But the above process can get bogged down quickly with loads of server-side logic, weighty scripts, and lots of vulnerabilities to hacking. So I decided to make a change. I’ve moved this site off of WordPress and it’s now a static website.
I still love WordPress
I don’t have any ill-will toward WordPress. It’s a great CMS. It’s the CMS. But I just don’t need it for this site. I don’t need its commenting system, its URL handling, its media library, or its database. As they say, use the right tool for the job.
Benefits of going static
It’s fast. You request a page, you get that page. There’s no database calls, no logic to assemble pages on the fly, and no clunky admin screens to wade through. If you use a robust service like Amazon S3, your static content will be served fast and reliably, even under heavy load.
It’s cheap. Web hosting can be dirt cheap anyway, but you can get more for less out of your standard cheap web hosts with a static site. My host, NearlyFreeSpeech.NET has a specific server type for hosting static websites that gives you very good pricing, abiding by their unique “pay for only what you use” model. You could run a low-traffic static site for a month or two with fifty cents.[1]
It’s portable. Want to move your static site to another server? Maybe your computer? With any good FTP client, that’s as simple as drag-and-drop. And if you are being cool and using git to version your code, well my friend, you can move your site around faster than a ferret with its fanny on fire. No database export, no SQL search and replace, no complicated re-configuration.
It’s open. You are free to use whatever tools you want to make your site. You could use all open source software. You could use some of the nice WYSIWYG apps for your operating system. You can choose from a huge list of static site generators — there’s one in just about every programming language you would want to use. As long as it produces HTML and CSS, you could use it to make your website.[2]
Why you might not want to go static
The biggest barrier to many of the static site generators that I have come across is that they aren’t easy for non-developers to use, even for basic use like adding content to an existing template. We tech-savvy folks write Markdown like it’s second-nature to us, but lots of folks don’t know how to do that. They might not know what plain text is. They might not know how to save out the site and upload changes. So if you are trying to make it easy for non-developers to add and edit content, a CMS like WordPress is a safer bet. If WordPress still feels like overkill for your project, you might be interested in Kirby or Perch, both of which have simple admin views and fairly straight-forward templating systems.
This site fried up with wok
I did a lot of searching, thinking, and tinkering around before settling on wok as my static-site generator. I came very close to using a generator written in Node.js called Metalsmith, but I didn’t like dealing with its “everything’s a plugin” philosophy. If you like Gulp, though, check it out.
Wok is written in Python, though you never have to write any Python code yourself to use it. I happen to know a bit of Python and I love the language. Still, that’s just icing. Wok’s greatest strengths are these:
- Any kind of content you want, saved in Markdown with YAML headers
- Easy-to-use templating system, Jinja2
- Only two command line commands to remember:
wok
builds your site into a build folder;wok --server
gives you a local URL to use in development.
Of all the generators I considered, wok was the only one that hit the balance of power and simplicity that I was looking for. Seriously. I came across generators with build commands that required multiple flags and arguments just to build your site with standard options. Gross. It’s tempting to add features to software—I know this from being a developer. So I appreciate that the developer of wok said “no” to whatever else could have been and left us with this beautifully simple program that does exactly what you want with one, three-letter command. It really is a work of art, but I digress.
I’m probably going to write some more about wok in the future as it is a great tool for beginner developers (and even savvy non-developers!) to use for creating nice static sites. I’d like to run through how I set things up and how I got around one of wok’s flaws (oh the suspense). If you are interested in some wok tutorials, let me know.
What’s old is new again
Websites started as static pages, and static sites have been making a comeback the last few years. I know it feels weird not having old faithful WordPress by your side, but consider going static for your next small project. I bet you’ll find it refreshing. Use wok, and you’ll fry up a tasty website in no time.
I love NFSN. If you are still on shared hosting but you want to escape the monopoly of GoDaddy, et al, then NFSN is a great option. Even if you are running WordPress, they’ve got great resources for making it faster and more secure. They don’t have an affiliate program, so you can be confident in the knowledge that I’m promoting them simply because they’re great. ↩︎
Technically, you could use Microsoft Word to make a website. I’m not ashamed to admit that I tried that back in the day. But this is a classic just because you could… situation. Do yourself a favor and use a program that was actually designed for making websites. ↩︎