| templates | ||
| .gitattributes | ||
| .gitignore | ||
| .python-version | ||
| config.yaml.sample | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| terminal-ssg.py | ||
| uv.lock | ||
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.
links.yaml
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.