Historically speaking static websites were the norm, and more websites were static than not, but that all changed when CGI came out and later PHP made dynamic websites more popular. There is certainly still a place for dynamic websites, but in many cases people that don’t need them end up using them.
What is a static website?
A static website is one that is built using HTML, CSS, and optionally JavaScript. It is a fast, reliable, and secure way to build a website. In this blog post, we will explain why you should make your website static.
Static websites are fast because they are simple. There are no databases or server-side code to slow things down. All of the resources are stored in one place and served to the user without any delay. It’s a lot easier to achieve 100/100 score on Google’s PageSpeed Insights with a static website, though you still have to be careful.
Static websites are reliable because they are not reliant on any third-party services. If one of those services goes down, your website will still work. By that I mean that you’re not hoping that you database will hold if you get a big spike in visits.
Static websites are secure because they are not vulnerable to attacks that exploit vulnerabilities in dynamic websites. By not having any server-side code, static websites cannot be hacked in the same way that dynamic websites can. Some static websites do have server-side code by way of JavaScript, but that’s not necessary by any means.
The percentage of websites that are static vs dynamic varies depending on who you ask. In general, it is safe to say that the majority of websites are dynamic. However, there is a growing trend of static websites, especially among smaller websites and personal blogs.
Some popular static website generators are Jekyll, Hugo, and Gatsby. This website is build with Hugo.
A main advantage of using a static website that is often overlooked
Hosting a website is not necessarily expensive, but as your website grows, so will your hosting bill. If you build your website this way, either manually in the old fashioned way or with a website generator, then you can host it for free (yes, that’s right) in many cases on something like GitHub Pages, GitLab Pages, Amazon S3, Netlify, and the list goes on.
Even if you are past free hosting plans, your hosting bill will still be orders of magnitude smaller as your website grows, and we all want our websites to grow right?
When is having a static website less desirable?
If you need to frequently update your website with new content, a static website may not be the best option. It can be more difficult to add new pages or make changes to an existing page. If your website is expected to grow and change over time, a dynamic website may be a better option.
If you need a website that is highly interactive, a static website may not be the best option. Examples of interactive websites include social networking sites and e-commerce websites. If your website needs to allow users to create accounts, post comments, or buy and sell products, a dynamic website would be a better option.
That being said, you can add comments, shopping carts and more even to a static website by using external APIs, either provided by a third party, or built by yourself and hosted in the cloud.
Where should you start?
There are a billion articles and videos online teaching you how to build a static website, but we suggest downloading Hugo and picking one of their free themes. You could be up and running with a static website literally in minutes. Here’s a quickstart article directly from them: