marzeq/ssg
clone
| dir | cmd/ |
| dir | example/ |
| dir | generator/ |
| dir | vendor/ |
| file | .gitignore |
| file | qk.mod |
| file | README.md |
README.md
ssg
A deliberately small static site generator written in QK.
Build or run the command package from the repository root:
qkc build ./cmd/ssg
qkc run ./cmd/ssg
qkc run ./cmd/ssg ./example
qkc run ./cmd/ssg ./example public
The first optional argument is the site root and defaults to the current
directory. The second is the output directory and defaults to dist. A
relative output directory is resolved beneath the site root; an absolute path
is used as given.
.mdand.htmlfiles belowpages/become reachable output pages.- Markdown bodies are converted with
vendor.mdhtml.md_to_html. - Files below
static/are copied verbatim into the output directory. - Files below
templates/are only emitted when a page or another template uses them.
Front matter is delimited by --- lines and supports quoted strings, signed
decimal integers, and true/false booleans:
---
template="article.html"
title="About"
published=true
weight=10
---
Templates support {{ variable }}, {{ content }}, flat includes, parent
templates, basic conditions, comparisons, and else:
{% include "header.html" %}
{% if published %}visible{% else %}hidden{% endif %}
{% if title == "About" %}about{% endif %}
Template and include paths are relative to templates/. Absolute paths and
. or .. path components are rejected. Parent templates and includes share
one cycle detector.
Deliberate limitations: quoted front matter strings do not process escape sequences; numbers are signed decimal integers; missing variables and invalid syntax are errors; page bodies are content rather than templates; symlinks and other special filesystem entries are rejected; the output directory is not cleaned before a build. Static files are copied after generated pages, so a static file with the same output path replaces the generated file.