Table of Contents
Introduction
Sharing your content with the whole world might sound like a solved problem, until you zoom in and start seeing myriad little cracks in the Matrix.
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 me who can willingly read more than a few lines of text.
What do Twitter, Instagram and Blogger have in common? Aside from being big and popular platforms, they all have the power to kick you 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 their work. Unfortunately, most creators 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, 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.
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 text combined with some additional instructions 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.
Every page you see in your browser is just a text file.
What Is a Static Website?
In a nutshell, a static website is just a collection of web pages. It’s a folder containing text files which usually reference each other, so you can navigate between them.
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 the 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 as a ready text file waiting to be served, 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 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 the 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.
Why Are Dynamic Websites More Popular?
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 their unique personal data.
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.
There is nothing wrong with using dynamic websites when you really need them. Unfortunately, there are a lot of dynamic websites which neither 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 or 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.
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 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 it when someone lays bare their dirty tricks. Static websites make it easy to resist attempts even when they come from the most powerful and highly organized groups.
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 to prepare a response
All of this makes your life harder and slows 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
Webpages are text files, so you can create or edit them in your favorite text editor.
There are lots of tools which can help you generate beautiful static websites from a bunch of simple Markdown files. My favorite is Hugo: it’s a single binary with no dependencies, and it builds a whole site in a fraction of a second. Markdown allows authors to focus on their content, so you don’t even need to know HTML in order to manage a sizable static website.
Webfeeds
Static websites make it easy to stay in touch with your audience. A webfeed is just another text file which your site serves alongside its pages, and it lists your latest content in a standard format. Most static site generators can create one for you with a single line of configuration.
Anyone who subscribes to your feed will be notified about every new piece of content, whether it’s writing, songs, works of art or a podcast. There is no platform in between, so nobody can de-platform you and your readers don’t need an account anywhere. This blog, for example, publishes its feed at /index.xml.
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.