zap is a static site generator
A wesbat@tilde.town production
Because easy.
git clone ~wesbat/code/zap
cd zap
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
mkdir -p ~/bin
ln -s $(pwd)/zap.sh ~/bin/zap
The above command assumes that ~/bin is in your $PATH environment variable.
You will now have the zap command.
usage: zap <content> <templates> <output>
Give it three paths: where your markdown content lives,
where your templates live, where to write the output.
just serve builds the included example site, then hit localhost:8000.
Write your content in Markdown syntax. The top of the file contains YAML front-matter, you can put whatever values you want to use in here, there is no hard-coded expectation.
If you do provide a template, it will be rendered using Jinja, otherwise
the raw HTML is dumped into the output (it won't have HTML/BODY tags).
The directory structure of your content is preserved, so you can create pages in whatever structure you like.
If you use a command runner (make or just) you can craft a recipe
to copy all other/static files to the output path.
The build recipe included in zap's justfile does this already.
post.md:
title: markdown syntax
date: April 2026
type: post
template: post.html
---
This is my **awesome** post.
post.html:
<html>
<body>
<h1> {{ title }} </h1>
<a href="/"> go Back </a>
<p>
<em> {{ date }} </em>
</p>
{{ content }}
</body>
</html>
Templates use the Jinja engine. {{ mustache }} braces are replaced
with variables.
| Variable | Description |
|---|---|
| {{content}} | The rendered HTML from your markdown (.md) files |
| {{current}} | The URL of the page currently rendered |
| {{index}} | List of pages in your site, each a dict of the YAML data |
| {{prefix}} | The value given to the --prefix command parameter |
You can browse the content of my tilde homepage to see how I use it: ~wesbat/code/homepage.
You can write your own Python functions in file zapfuncs.py in your site's
directory, call these as {{ timestamp() }} in your templates.
That's all folks.