Hasty Briefsbeta

Bilingual

A static site generator written in POSIX shell

2 months ago
  • #shell-scripting
  • #web-development
  • #static-site-generator
  • The author created a static site generator (SSG) named 'gen.sh' in POSIX shell to replace a previous JavaScript-based setup.
  • The SSG processes markdown files with frontmatter metadata, generates HTML pages, tags, RSS/Atom/JSON feeds, a sitemap, and handles drafts.
  • It uses 'comrak' for markdown rendering with extensive extensions for features like side-by-side images, captions, and media autodetection.
  • The script employs shell utilities like 'sed', 'envsubst', and 'eval' for text processing, templating, and dynamic variable handling.
  • Tags are managed through a custom system that tracks posts per tag and generates a tags page with CSS interactivity.
  • The SSG is fast, processing 29 posts in about 714 milliseconds, and is designed for simplicity and fun rather than portability or reusability.
  • The author plans to streamline the feeds, keeping only Atom, and considers switching to bash for better compatibility with certain commands.