Building a website in 2021
Intro
I had two goals for the first few months of 2021:
- Move house
- Create my own website
We are almost there with the first one (moving during a pandemic has been… tricky) but the second one has been something I’ve skirted around for a very long time now, why?
This is the story of how I went through the dizzying array of web technologies and, spoiler alert, ended up using none of them.
Hosting
First things first, where is my site actually going to “live”? There is not much point building one if I’ve got nowhere to serve it out from. For what it’s worth, I didn’t consider anything like Wix or Squarespace for this - considering my profession I should build my own site.
As it happens a lot of the complexities of a getting a site hosted and available via a URL has actually been abstracted away in recent years. Platforms like Netlify and Vercel make it incredibly easy; just provide a Git repo (or even just a folder full of files) and they will get your site hosted for you with a Let’s Encrypt certificate. Amazing! That was easy, no more time needed to thinking about servers 👍
Requirements
A fairly simple list to get started:
- Homepage with a list of posts
- A page per post
- 100 lighthouse scores across all metrics
Static Site Generators
The trendy thing to do nowadays when building a site that consists of static files is to use a generator, and there are literally hundreds to choose from. Jamstack.org has a big, long list of them (over 320 at the time of writing) which is pretty crazy and actually presents a real conundrum - which one to choose? Here are the top five by order of Github Stars:
- Next.js
- Hugo
- Gatsby
- Jekyll
- Nuxt
This didn’t quite feel like the right shortlist for me. I don’t have any experience with Ruby and it’s not a language I need to learn so that rules out Jekyll. I’m also not a huge fan of React so that ruled out Next and Gatsby. Finally, Nuxt feels like a framework more suited to highly interactive applications than simple sites like this one.
My list ended up looking like this:
- Hugo
- 11ty
- Gridsome
There is a lot of like about them all but I always had the same nagging thoughts… do I really need a GraphQL API? Do I really need hundreds of dependencies or a complex build pipeline or SASS? This all feels like overkill for what will start life as a homepage and a blog post.
Epiphany
After months and months of being sidetracked I read this article by Steren Giannini that really resonated with me. I don’t need anything to get my site online apart from an index.html file for the homepage, a folder with blog posts in and a CSS file. That’s all I actually need and all I should actually start with! Keep it simple, add complexity later if and when needed.
Onward
SSGs are great and I’ll probably revisit using one in the next couple of weeks if I find myself needing things like partials, tagging, shortcodes etc but just the bare basics is great for now. I can just write my posts in Bear, export them to HTML, copy a previous post and paste the new posts HTML into it. This is of course more time consuming than an SSG but at least I don’t have megabytes of dependencies to worry about, just a code editor and a web browser.