Static site generator explained

Static site generators (SSGs) are software engines that use text input files (such as Markdown, reStructuredText, AsciiDoc and JSON) to generate static web pages.[1] Static sites generated by static site generators do not require a backend after site generation, making them first-class citizens on content delivery networks (CDNs). Some of the most popular static site generators are Jekyll, Hugo, Next.js (JavaScript).[2] [3] SSGs are typically for rarely-changing, informative content, such as product pages, news articles, software documentation, and blogs.

Architecture

SSGs typically consist of a template written in HTML with a templating system, such as liquid (Jekyll) or Go template (Hugo). The same structure (typically a Git repository) includes content in a plain-text format such as Markdown or reStructuredText, or in a structural meta format such as JSON or XML. A single plain-text file may correspond to a single web page. Alternatively, a single structural metadata file may correspond to an entire website if a single-page application framework like AngularJS is used. The website variable settings are stored in a plaintext configuration file _config.yml (YAML), _config.toml (TOML) or _config.json (JSON). Page files typically also start with a YAML, TOML, or JSON preamble to define variables such as title, permalink, or date. Files with names that begin with an underscore (_) such as _index.md (as opposed to index.md) are considered templates or archetypes and are thus not rendered as pages themselves.

Examples

Several hundred SSGs have been documented to exist, with the vast majority being written in languages that are already prominent on the web, such as Python, Go, JavaScript and TypeScript.[4]

System label/nameLanguageNotes
JekyllRubyUses Liquid templating language.
HugoGoUses Go templates and its main selling point is its high speed when compiling.
Next.jsJavaScriptUses React templates.
PelicanPythonUses Jinja2 templates. Compiles HTML from reStructuredText or Markdown.
AstroJavaScriptUses the .astro syntax language by default (familiar to HTML or JSX). Supports multiple frameworks: Svelte, React, Preact, Vue, SolidJS, Lit, AlpineJS. Compiles HTML from Markdown or MDX.
DocusaurusJavaScriptCompiles HTML from MDX, Markdown, JavaScript and React. Uses Node.js. Customization with React.

Comparison with server-side systems

Many server-side template systems have an option to publish output pages on the server, where the published pages are static. This is common on content management systems, like Vignette, but is not considered out-server generation. In the majority of cases, this "publish option" doesn't interfere with the template system, and it can be made by external software, as Wget.[5]

People began to use server-side dynamic pages generated from templates with preexisting software adapted for this task. This early software was the preprocessors and macro languages, adapted for the web use, running on CGI. Next, a simple but relevant technology was the direct execution made on extension modules, started with SSI.

External links

Notes and References

  1. Web site: What is a Static Site Generator? How do I find the best one to use? . live . https://web.archive.org/web/20220918055651/https://www.netlify.com/blog/2020/04/14/what-is-a-static-site-generator-and-3-ways-to-find-the-best-one/ . 2022-09-18 . 2022-09-18 . Netlify . en.
  2. Web site: 2021-12-15 . What Is a Static Site Generator, and How Can It Help Your Website Creation Process? . live . https://web.archive.org/web/20220918062228/https://teleporthq.io/blog/what-is-a-static-site-generator . 2022-09-18 . 2022-09-18 . TeleportHQ . en.
  3. Web site: 2022-09-18 . What is a static site generator? . live . https://web.archive.org/web/20220918084823/https://www.cloudflare.com/learning/performance/static-site-generator/ . 2022-09-18 . 2022-09-18.
  4. Web site: Static Site Generators - Top Open Source SSGs Jamstack . live . https://web.archive.org/web/20220918062619/https://jamstack.org/generators/ . 2022-09-18 . 2022-09-18 . Jamstack.org . en.
  5. Web site: Static Site Generator . live . https://web.archive.org/web/20220918061826/https://www.gatsbyjs.com/favicon.ico . 2022-09-18 . 2022-09-18 . Gatsby . en.