a sustainable static site generator
A static site generator has one, arguably pretty easy, job: To fill existing HTML templates with content provided by the user in text form.
Since 2012, this project's goal is provide a tool does this job well enough, but on the other hand ensures, that the tool stays simple enough to still work exactly the same way in one, five, or ten years from now:
No feature creep, no incompatible configuration files, or deprecated template languages.
Tack is a command-line application that compiles input files in various markup languages into a static website. It is strongly modeled after Bonsai & Stacey and is a lot less complex to setup and operate than nanoc, or more modern alternatives, like Hugo.
The software is written in Go and is available for FreeBSD, Linux, macOS, NetBSD, OpenBSD, and Windows.
On a Mac, simply run:
brew install roblillack/-/tack
For other operating systems, feel free to download binaries from the release page or install from source (you will need to have Git and Go installed) like this:
go get github.com/roblillack/tack
tack(or the full version:
tack tack) Generates the static site in directory
tack serveGenerate the site and start a web server listening on port 8080 to directly try it out.
tack helplists all available commands.
A tack project dir basically is structured like this:
content/Holds a sub-directory for each page. Inside of a page directory at least one metadata (.yaml) or markup (.md) file has to be provided.
templates/Contains all the templates in the Mustache template language.
public/Any data that is necessary for the operation of the site shall be put here (
site.yamlOptional site-wide metadata. This file can actually have any name.
Any page of your site will have to be in its own directory. The template used to render a page will be taken from the basename of the metadata file, with a fallback of
default if page metadata file exists.
The URL component, or permalink, of a page is derived from the directory name. A potentially leading enumeration prefix is trimmed from the name.
content/ directory inside a project dir:
content/ ├── about-me │ ├── default.yaml │ ├── body.md │ └── me.jpg ├── bikes │ └── body.md └── work └── serious.yaml
a website would be created that contains three pages:
templates/default.mustache; filled with all variables in
default.yamland a variable
bodythat contains the processed markdown from
body.mdas HTML) and a file
templates/default.mustache; filled with a variable
bodythat contains the processed markdown from
templates/serious.mustache; filled with all variables in
bodywill not be defined)
Next to the user-provided page and site variables, the following special variables are available to use in the templates:
For any page:
permalink: An absolute link to the referenced page.
slug: Last part of the directory name, stripped of any enumeration prefixes.
name: A titlecased version of
current: Boolean to signify if the referenced page is the one currently being rendered (usefull to build active elements in navigation menus)
first: (Only if this page is being iterated over as part of a list) Boolean to signify if the referenced page is the first one of the list.
last: (Only if this page is being iterated over as part of a list) Boolean to signify if the referenced page is the first one of the list.
Additionally, the currently being rendered page gets these special variables:
parent: An object detailing the parent page (giving the variables listed above), this is page is not a top-level one.
siblings: List of all (non-floating) sibling pages.
menu: List of all (non-floating) pages on the same level (siblings + current page) to allow for building navigation menus.
children: List of all (non-floating) child pages.
posts: List of all child pages whose directory name starts with
ancestors: List of all ancestor pages.
navigation: List of all toplevel pages to allow for building navigation menus.
Tack does not contain any plugin functionality. To extends this tools functionality, built something around it to automatically generate content or metadata files.
Plumbing together a tool like this in virtually no time would not be possible without an ecosystem of frameworks and libraries that you'll only find in the OSS space. Tack is standing on the shoulders of the following giants:
Earlier versions of the tool (up until 0.5.1) were written in C# and leveraged the “Common Language Runtime (CLR)”. These versions used the following libraries:
: Tack should even be downward compatible to older Bonsai versions (up until ~1.2.x). As long as Mustache (instead of Liquid) is used as a template language and LESS (instead of SASS) for style sheets, most Bonsai sites shall be tack-able out-of-the-box.