Static site generators: between old school and CMS
December 20, 2018
A static site is a collection of pages produced from simple .html files.
You can directly write this type of page by hand, even if the management of the structure and set-up starts to become problematic as the number of pages increases.
A content management system ( CMS ) allows the content of the pages to be stored in a database and provides the tools suitable for modifying them and updating them dynamically, usually via a dedicated control panel. Management becomes easier, but you have to use a server technology package.
A static site generator ( SSG ) is a sort of compromise between the use of HTML “by hand” (or static), and that of a CMS. HTML is generated using raw data such as markown (.md) and template files , a concept similar to that of a CMS, with the difference that in most cases a database is not used, but, as we said, a markdown file. The result is then transferred to the live server. Very famous and high quality examples of SSG are Jekyll , Pelican , Hugo and Metalsmith .
The precise functioning of a Static site generator system goes beyond the objectives of the article, however, we can help the developer in choosing the technology to be used through a simple analysis.
Then we have the possibility to use the CMS , like WordPress , which allow us to relieve the problems that derive from having to write code “by hand”, providing tools for templating and management of services such as login, sessions, dynamic updates. However, the great power provided by CMS has been, as often happens, overused: the vast majority of websites are in fact written using WordPress.
The choice of the Static site generators lies exactly in the middle: it allows to create dynamic websites , in a way similar to that offered by CMS, keeping the ” heart” of development on the static side . This solution brings many advantages, such as generally higher performance, independence from server environments and technologies such as PHP and MySQL, the lower volatility of data that, not being based on databases but on markup files , can be stored through a system version control as Git , to ensure maximum data security. Furthermore, with a slight additional effort, a deployment system can be implemented to build the site on a staging server , and then update the live server when the new content has been revised and approved.