Hans Jarett Ong
Lab Note2023

Retro Site & Custom Python SSG

A retro-themed predecessor to this portfolio powered by a custom Python static site generator and 8-bit image retrofier CLI.

PythonStatic Site GeneratorPILRetro Web

The precursor to my current portfolio: an early-web retro-themed personal site built from scratch without modern web frameworks. You can still browse the live archived 2023 retro site directly (complete with Fixedsys typography, retrofied 8-bit portrait, and dropdown navigation).

Under the Hood: Custom Python Site Builder

To build this retro site, I bypassed modern frameworks and wrote my own custom Static Site Generator (SSG) in Python. The architecture separates site content from layout structure through a recursive template rendering engine.

The Compilation Engine (compile_site.py)

The core of the site builder is a Python script that reads the site’s architecture from a YAML configuration file (site-template.yaml). Key features include:

  • Recursive Template Rendering: Recursively parses base and child templates, replacing custom variable placeholders (such as {{header_text}} or {{main_html_content}}) with injected text or HTML partials.
  • Dynamic HTML Generation: Detects dictionary values and automatically converts them into nested HTML unordered lists (<ul> and <li>), used to generate the site’s file-explorer navigation structures.
  • Automated Build Process: Creates the required directory hierarchy and compiles final static HTML pages into a build/ directory for deployment.

Image Retrofier Tool (image_retrofier.py)

To ensure visual assets matched the vintage aesthetic, I also built a Python CLI tool using the Python Imaging Library (PIL):

  • Resolution Scaling: Automatically computes the scaling factor needed to downscale modern high-resolution images to a classic target resolution (defaulting to a 640×480 ratio).
  • Color Palette Reduction: Aggressively quantizes bit depth to an 8-bit palette of 256 colors, simulating early web graphics.

Preview

Screenshot of the retro-themed personal website generated with RetroSSG