An SSG for generating a psudo-terminal website
Find a file
2025-11-11 21:22:51 +11:00
templates renaming variables 2025-11-09 22:05:02 +11:00
.gitattributes Initial commit 2024-09-05 02:36:56 +10:00
.gitignore uv 2025-11-09 22:14:46 +11:00
.python-version uv 2025-11-09 22:13:43 +11:00
config.yaml.sample renaming variables 2025-11-09 22:05:02 +11:00
LICENSE Initial commit 2024-09-05 02:36:56 +10:00
pyproject.toml uv 2025-11-09 22:13:43 +11:00
README.md renaming variables 2025-11-09 22:05:02 +11:00
terminal-ssg.py removed old library 2025-11-11 21:22:51 +11:00
uv.lock uv 2025-11-09 22:13:43 +11:00

Terminal Static Site Generator

A static site generator that takes a directory structure and turns it into a pseudo-terminal-like website.


To get started, copy config.yaml.sample into config.yaml if you want to use a template.

cp config.yaml.sample config.yaml

To run, use uv.

uv run terminal-ssg.py

Runs on the public directory in working folder.

Config File Parameters

Parameter Type Explanation
url String URL of your website
hostname String Fictitious hostname of your "server"
username String Fictitious username of your "server"
cwd String Current Working Directory. Not actually needed in the config file as it is created and edited at runtime but can be used as a variable in prompt.
prompt String Format of the terminal (PS1) prompt
ignored String Array Files/folders to be ignored and not be displayed on site
force_dir String Array Folders to force-display as a directory page regardless of contents
logo String Text-based logo to be displayed on root and directory pages. Requires a leading character so whitespace isn't eaten
root_preamble String Array Text that will be displayed before the logo at root. Each item is a new

block

root_logo String Text-based logo to be displayed on root. Requires a leading character so whitespace isn't eaten
root_postamble String Array Text that will be displayed after the logo at root. Each item is a new

block

root_headers String Array Headers that will only be put in the root <head> block
error_page Dict Array Array of dictionaries with keys error and text to render http error pages
embed_title String Title to be used in embeds
embed_desc String Default embed description to be used in the root page
embed_image String Default image to be displayed in embeds
embed_color String Color to highlight embeds
txt_command String Fictitious command that will preface the display of .txt files
md_command String Fictitious command that will preface the display of .md files
html_command String Fictitious command that will preface the display of .html files

Each key in the yaml file can be used as a templating variable in the file by surrounding it with braces such as {username} due to Python's str.format function.

Example provided in config.yaml.sample.

File Display

The kinds of files that will be read and displayed are:

.txt

Inserted in a <pre> tag.

.md

Parsed through a markdown parser to html and inserted verbatim without autoescape.

.html

Inserted verbatim without autoescape.

A yaml file containing an array of dictionaries with the keys name and href to be inserted to allow external links.

e.g.

- name: example
  href: https://example.com

Everything else will be listed in the ls module unless blacklisted in the config file.

Example output and website this was made for can be found at https://rockofdestiny.com.