Jump to content

Static site generator

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Fuse809 (talk | contribs) at 09:28, 18 September 2022 (Minor fix). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


Static Site Generators (SSGs) are engines that use flat text input files like markdown. reStructuredText, and AsciiDoc to generate a static web page. Examples Jekyll (on GitHub), Hugo (on GitLab), and Next.js (JavaScript).[1][2] Static sites generated by static site generators do no access any backed after the site is generated, making them first-class citizens on content delivery networks (CDNs).[3] SSGs are typically for informative content, such as: product pages, news websites, (software) documentation, manuals, blogs, etc.

History

Prior to static site generators paradigm becoming widespread, Wikipedia functioned as a avant-la-lettre SSG, using markdown to serve static encyclopedic articles.

The first modern static site generator was Jekyll released in 2008 by Tom Preston-Werner, one of the co-founders of GitHub. It popularized a system which:

  • takes flat-text markdown inputs for content
  • stores the template and content in the same structure (like a git repository)

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. A single file often correspesponds to a single web page. The website variable settings are stored in a flat-text configuration file _config.yml (YAML) or _config.toml (TOML). Page files typically also start with a YAML or TOML preamble to define variables such as title, permalink, date, etc. 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 hundreds 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, and JavaScript.[4]

System label/name Language Notes
Jekyll Ruby
Hugo Go
Next.js JavaScript
Pelican Python

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]

Server-side systems

Server-side template system

People began to use server-side dynamic pages generated from templates with pre-existent 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.

The basic process for a server-side web templating system: content (from a database), and "presentation specifications" (in a web template), are combined (through the template engine) to mass-produce web documents.

See also

References

  1. ^ "What Is a Static Site Generator, and How Can It Help Your Website Creation Process?". TeleportHQ. 2021-12-15. Archived from the original on 2022-09-18. Retrieved 2022-09-18.
  2. ^ "What is a Static Site Generator? How do I find the best one to use?". Netlify. Archived from the original on 2022-09-18. Retrieved 2022-09-18.
  3. ^ CloudFlare (2022-09-18). "What is a static site generator?". Archived from the original on 2022-09-18. Retrieved 2022-09-18.
  4. ^ "Static Site Generators - Top Open Source SSGs | Jamstack". Jamstack.org. Archived from the original on 2022-09-18. Retrieved 2022-09-18.
  5. ^ "Static Site Generator". Gatsby. Archived from the original on 2022-09-18. Retrieved 2022-09-18.