On a static site, every page is a ready-made file. When a user opens an address, the server sends that file without running any code or querying a database. The content is the same for all visitors unless the file itself changes.

Example#

Consider a business site with a few pages such as "About us", "Services" and "Contact". If its text rarely changes, the HTML files can be placed directly on the host or even published on free static hosting services.

Advantages#

  • Very high speed, because the server only hands over files
  • Better security, because there is no dynamic part or database to be hacked
  • Low hosting cost and the ability to use a CDN
  • High stability under heavy traffic

Limitations#

  • For every change you have to edit the file and publish it again
  • It has no features such as user login, a shopping cart or comments, unless you use external services and JavaScript
  • Managing hundreds of pages without tools is difficult

Static site generators#

Tools such as Jekyll, Hugo and Astro take content from text files and templates and produce a set of ready HTML. This method is very common for blogs and technical documentation.

Difference from a dynamic site#

On a dynamic site, the page is built from data at request time; WordPress is the familiar example.