Overview

SiteGen is an open-source static site generator written in the Go programming language and maintained by Altlimit LLC. It takes a source directory containing the pages of a website and builds them into an output directory of static files, which can then be served by any ordinary web server or static hosting service.

The project is distributed as a single binary and does not depend on an external build toolchain. There is no bundler or package manager to install alongside it, so a working copy of the generator is sufficient to build a site. SiteGen is published on GitHub, where its source code and issue tracker are available at github.com/altlimit/sitegen.

Features

  • HTML and Markdown pages — Pages may be authored either as HTML files or as Markdown files, allowing markup-heavy pages and prose-heavy pages to live in the same source tree.
  • YAML front matter — Each page begins with a YAML block that carries its metadata, which is made available to the templates that render the page.
  • Go template rendering — Pages are rendered through Go's html/template syntax, with shared layout partials so that common markup is defined once and reused across pages.
  • Data files — Structured data can be kept in separate files and referenced during rendering, rather than being repeated inside individual pages.
  • Sitemap generation — A sitemap for the generated site is produced as part of the build.
  • Development server — A built-in server previews the site locally and reloads it as source files change.
  • Optional editing UI — An editing interface can be enabled alongside the development server for changing content through the browser.
  • No external toolchain — The generator requires no bundler or package manager beyond the single binary itself.

How It Works

A SiteGen project is organized around a source directory of pages. Every page file opens with a YAML front-matter block describing that page, followed by the page body in HTML or Markdown. During a build, SiteGen reads each page, makes its front-matter values available to the template layer, and renders the result through Go's html/template engine. Layout partials shared across the project supply the surrounding structure, so individual pages contain only the content specific to them.

Content that is not tied to a single page can be placed in data files and referenced while rendering, which keeps repeated values in one place. The build writes the finished pages into the output directory along with a sitemap, producing a set of static files with no server-side runtime requirement.

Usage

SiteGen is typically run in one of two modes. During development, the built-in server renders the site and applies changes as source files are edited, with the optional editing UI available for making content changes from a browser. For publishing, the generator performs a full build of the source directory into the output directory, after which the resulting files can be deployed to any static host.

SiteGen is the generator behind several Altlimit sites, including the WikiYou encyclopedia, which is built from a source tree of profile pages using the same front matter and template conventions described above.