Let curiosity lead the way
Websites can be of 2 types: static and dynamic. For static types, when user requests a file, server sends the file and user can see it. Every page is hand coded in html. In a dynamic type, When user requests, content is generated and server builds the page then sends it to the user. Generally managed by CMS like Wordpress or Joomla.
Static site generator (SSG) bridges the gap between static HTML sites and CMS based sites (like Wordpress). It provides better performance of static sites and we do not have to write HTML for content of our site.
Think of a static site generator as a script which takes in data, content and templates, processes them, and outputs a folder full of all the resultant pages and assets.
In short, SSGs bring good of both worlds together.
Static websites do not have a database and all our server does is returns the file asked by user.
Our server becomes dumb (doesn't use logic to construct page) so no security issue to exploit.
Static websites perform better and load faster because the page isn’t constructed at run time.
3. Version Control
Our website can live in a version controlled environment, meaning if you make a mistake you can go back to a previous version in one command.
When the number of users on a dynamic website increase it would mean to efficiently scale the website to ensure every user's page is served as quickly as possible while for static sites thats not a issue because our work is pre-done. Our website pages are already made and we just have to provide them.
Static websites are obviously cheaper because we dont have to buy expensive server space as in the case of dynamic websites. We can even host our website on services like github or netlify.
Caching is easier with static sites as any URL will return same HTML content until and unless that file is updated by site owner. But with dynamic sites, content changes all the time so caching becomes difficult.
According to Staticgen:
-Mathias Biilmann (CEO & Co-founder of Netlify)
The above mentioned frameworks are based on JAMstack. Now what is JAMstack?
The focus on performance has increased and we cannot simply wait for 5 seconds for a website to load. With the requirement of faster sites developers had to move to SSGs.
Previously published at https://www.arjitsharma.com/posts/staticsitegenerators/
Create your free account to unlock your custom reading experience.