Static Websites are the Future of Self-Publishing
May 19, 2022  |  Publishing

Sharing your content with the whole world might sound like a solved problem, until you zoom in and start seeing myriads of little cracks in the Matrix.

Introduction

There is no shortage of platforms which let you publish all kinds of content online. Twitter would gladly let you share your every thought on their website, Instagram can’t wait for your next vacation photos to be uploaded and shared with everyone, and there is Blogger for dinosaurs like you and I who can willingly read more than a few lines of text.

What does Twitter, Instagram and Blogger have in common? Aside from being big and popular platforms, they all have a power to kick your out of their walled gardens and to delete the content they don’t like for any reason.

Every content maker wants to be able to easily reach their audience and the web is the best place to share your works. Unfortunately, most content makers don’t really know how to publish their stuff online without relying on huge intermediary platforms.

Using a publishing platform can simplify your life, but there is no such thing as a free lunch. You and your audience will have to either pay substantial fees or be bombarded with endless ads, needless to say that your every step will be tracked and shared with anyone willing to pay for it. To add insult to injury, you will always be at risk of being de-platformed with no explanation.

In this post, I’m going to suggest an alternative to being a serf of a huge publishing platform.

What is a Website?

Let me cite Wikipedia:

A website (also written as web site) is a collection of web pages and related content that is identified by a common domain name and published on at least one web server. Examples of notable websites are Google, Facebook, Amazon, and Wikipedia.

That’s it, every publishing platform is made from the same simple matter. Every website you see in your browser is just a bunch of web pages which are being served by a special program called a webserver.

What’s a web page, though? It’s the thing you’re reading now, it’s just a text combined with some additional information on how to format it and where to place it. You can right-click on this page in your browser and select “View Page Source” from the drop-down menu in order to see the whole web page the way your browser sees it.

What is a Static Website?

In a nutshell, a static website is just a bunch of text files. That’s actually how the web was meant to operate: let’s say you want to visit a website https://acme.com, so you type it into an address bar of your browser. Your browser will then fetch a text document from the webserver which is attached to that domain name:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Acme company</title>
</head>
<body>
  <p>Welcome to the Acme company's website!</p>
</body>
</html>

The fact that you received this document doesn’t mean that it was stored on a webserver though. Many websites prefer to generate documents on the fly, so they can store only a template like this:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>${company_name}</title>
</head>
<body>
  <p>${greeting_message}</p>
  <p>${latest_news_item}</p>
</body>
</html>

This looks similar to the first example, but it doesn’t contain any actual data. This approach is called dynamic because your webserver will create a document on the fly every time a browser requests a web page. All of those placeholder variables will be replaced with an actual data during the response generation process. Static websites pre-generate all of their pages, so they can avoid doing any heavy work when they need to serve new requests.

If dynamic approach sounds like an unnecessary complication, it’s because it is. In many real world use cases, you don’t need to use a database and an obscure templating engine in order to have your own website and publish your content online. All you need is content and a few lines of HTML and a CSS. Among those things, the hardest one to produce is content, HTML and CSS are trivial to make and adjust.

Some websites are inherently dynamic. Let’s say we have a website which has an authentication system with a user profile page, something like https://acme.com/account. This user account page should show different data to different users. People have different email addresses, profile pics and nicknames, but they all go to a single web page which is expected to be filled with personalized data so every user may get a unique response.

That sort of scenario is where dynamic websites shine. Basically, dynamic means unpredictable. When it comes to publishing your writings, photos or even a podcast, there is no need to use dynamic pages. You usually have all the content before you hit ‘publish’, so it makes sense to pre-generate your HTML pages and avoid more complex dynamic deployments.

There is nothing wrong with using dynamic websites when you really need them. Unfortunately, there are a lot of dynamic websites which don’t use nor need dynamic features. By using a dynamic approach when it’s unnecessary, you get zero benefits while paying huge extra costs. The thing is, dynamic features aren’t free. They can be disastrous for content makers and their audiences alike.

How to Recognize Static Websites

To show you a webpage, your browser sends a request to a webserver associated with its domain name. In response, it gets a bunch of text, and it doesn’t really know nor care if this text was pre-generated. As a visitor, you aren’t supposed to tell the difference between static and dynamic websites.

In practice, it’s easy to figure out if a website is static. If it’s fast, it’s static, if it’s slow, it’s most likely dynamic. Static websites already have all the answers to all possible questions, so they can quickly return that bunch of text mentioned above, usually stored as .html files somewhere on a webserver. That’s the secret of static websites: since all their pages are pre-generated, there is no need to “think” and generate pages on the fly every time a new request comes.

Static Websites are Good for Content Makers

You need to have a webserver in order to publish HTML documents, but if your pages are dynamic and parts of their content are stored in a database somewhere, you also have to set up and manage that database as well. Complexity is the enemy of resilience and self-sovereignty. Of course, this unnecessary complication leads to unnecessary dependence on various third-party services which promise to make your life a bit simpler. Those services aren’t charities, and they have an incentive to keep you dependent on their tools. They also need to be flexible in order to meet the needs of their huge and diverse user base. Don’t expect the end result to be optimized for your particular use case.

I know a guy who has a website which exposes various financial fraud schemes. Obviously, the fraudsters are dreaming of taking his website down. Luckily for them, it’s a dynamic WordPress website, so they flood it with millions of requests from time to time, which is enough to take it down for days. This guy struggled with this problem for a long time and ended up hiring some expensive consultants to help him solve this problem. It didn’t solve the problem completely, but it made the attacks more expensive.

Exposing fraudsters isn’t risk-free, but what about exposing nation states? These entities have tremendous influence, and they don’t like when someone lays bare their dirty tricks. Static websites make it easy to resist attempts even when it comes from the most powerful governments.

Static Websites are Good for Users

As I mentioned earlier, one of the surest ways to find out if a website is static is to check how long it takes to load a webpage. Remember, only static websites have all of their pages ready to be served, dynamic websites have to start their routines from scratch every time they receive a new request.

In order to generate an HTML document on the fly, a webserver has to query a database and then replace all the placeholders with the data it gets from database query results, which means:

  • You need to have a database
  • You also need to query that database every time a new request comes in order to prepare a response

All of this makes your life harder and slow down your website. No one likes slow websites, so your audience will thank you if you pick the static option.

How to Create Static Websites

A static website is just a collection of HTML files and other related resources such as styles, images, videos and so on. HTML pages are text files, so you can create or edit them in your favorite text editor.

As your website grows, you might find out that maintaining it is quite a chore. Let’s say you have 100 pages, and you need to change an element which is present in 90 of them. First, you need to find those pages, and then you need to manually update all of them. That’s usually a point when people start thinking about going dynamic, but having a static website doesn’t mean you can’t automate repetitive tasks, you just need to use a tool which can provide that automation and generate a static websites for you.

There are lots of tools which can help you generate beautiful static websites from a bunch of simple Markdown files. Markdown is the format used by Wikipedia, and I bet most of Wikipedia’s contributors don’t know how to create HTML documents. Markdown allows authors to focus on their content, and there are plenty of open source tools which can transform Markdown files into HTML documents, so you don’t even need to know HTML in order to be able to manage a sizable static website.

Conclusion

Static websites provide immense benefits for content creators and their audiences alike. In my view, dynamic websites are overused, and it damages the Web. Having your own static website isn’t hard, and we should empower and encourage more people to self-publish their content. Knowing that we may be censored affects our behavior, that’s why I believe we should move the Web away from centralized platforms and let its users take back control over their digital presence.