In the early days of the internet all web pages were static: they displayed the same content to every user. Over time dynamic, database-backed websites emerged powered by programming languages like Python, Ruby, PHP, and Java emerged.

Today most websites are dynamic. If you need a login system (Facebook, Gmail), to accept payments (Amazon), or a back-end content management system (CMS) for non-developers to make updates, like WordPress, then you are talking about a dynamic site.

But while most websites are dynamic, many don’t need to be. And there are distinct disadvantages to running a dynamic website related to security, cost, and loading speed.

Here is a brief comparison of the pros and cons of static vs dynamic websites:

Static Website Pros:

  • fast—no lengthy load times when displaying the page
  • secure—no database so little risk of being hacked
  • cheap—hosting costs pennies per month since no database is involved
  • easy for a developer to setup

Static Website Cons:

  • requires a developer to update content
  • can’t display dynamic content to users, for example via a login-form

Dynamic Website Pros:

  • dynamic content generated for each user
  • easy to update with a CMS like Wordpress
  • more powerful with features like login, payments, etc.

Dynamic Website Cons:

  • slow—can have long load times due to interacting with a database
  • insecure—vulnerable to security hacks
  • expensive—setting up, maintaining, and scaling a database is costly
  • complex—much more steps involved to setup and deploy

In recent years, static site generators have emerged to bridge the gap between static and dynamic websites. Popular among developers (I’m using one to power this website), they have not crossed over into the mainstream.

A static site generator lets you build a powerful, server-based website locally on your computer but pre-builds the site into static files for deployment.

One advantage is developers can use dynamic templates which are extremely powerful. For example, with a dynamic template I can write the code for the footer (bottom part of the page) once and it will be inserted into all subsequent pages. On a static site, you must manually type the code into each page which is time-consuming, error-prone, and hard to update.

A growing number of third-party services are also emerging to provide static websites with dynamic-like functionality such as forms for collecting emails for newsletters, live messaging, search, comments, and more.

The missing piece for static site generators to truly crossover into the mainstream is a CMS for non-developers, but there are several static CMS solutions available and more on the horizon.

In my opinion, it’s only a matter of time before static site generators take over. Web pages that are essentially static should be deployed as such; dynamic web pages should be reserved for the true cases where only truly dynamic solution will do.