Static site source for stochasticcodemonkeys.com.
This repo uses a small Python build script to turn Markdown, YAML metadata, templates, and static assets into a deployable site under dist/.
.
├── build.py # Static site generator
├── dev_server.py # Dev server with file watching and auto-rebuild
├── new_post.py # Scaffold a new draft post
├── content/ # Markdown content and site metadata
│ ├── authors/
│ ├── pages/
│ ├── posts/
│ ├── site.yml
│ └── tags.yml
├── static/ # Copied directly into the built site
├── templates/ # HTML templates
├── serve-flat-site.sh # One-shot build and serve (no watching)
└── package-flat-site.sh # Build and package dist/ as a tarball
- Python 3
- PyYAML available to
python3
If needed:
python3 -m pip install pyyamlUse the dev server for day-to-day writing. It builds the site on startup, then watches content/, templates/, and static/ for changes and rebuilds automatically.
python3 dev_server.pyDefault preview URL:
http://localhost:9405
Use a different port:
python3 dev_server.py 8080To include draft posts in the preview:
python3 dev_server.py --draftsScaffold a new draft post with pre-filled frontmatter:
python3 new_post.py "My Post Title"This creates content/posts/my-post-title.md with draft: true set. Open the file and write the body. The dev server will pick up changes automatically if it's running.
Remove (or delete) the draft: true line from the post's frontmatter and rebuild.
Any post or page with draft: true in its frontmatter is excluded from normal builds. To preview drafts locally:
python3 dev_server.py --draftsDraft posts rendered in draft mode display a visible "DRAFT" banner at the top of the page.
If not using new_post.py, add a Markdown file under content/posts/ with YAML frontmatter:
---
title: Post Title
slug: post-slug
author: jason
tags:
- field-notes
date: 2026-01-01T00:00:00+00:00
updated: 2026-01-01T00:00:00+00:00
---Add a Markdown file under content/pages/ with frontmatter including at least title, slug, author, date, and updated.
Put source images in static/assets/images/. Reference them in Markdown with paths like /assets/images/example.png. The build generates optimized derivatives automatically (see Image Pipeline).
content/site.yml— site-wide metadata and canonical URLcontent/tags.yml— tag labels and descriptionscontent/authors/— author records used by posts and author pages
To build without serving:
python3 build.pyTo build including drafts:
python3 build.py --draftsBuild output is written to dist/. The build emits:
- Homepage and content routes
- Post, page, tag, and author pages
feed.xmlsitemap.xmlllms.txtrobots.txt.htaccess
Create a deployable tarball containing dist/:
./package-flat-site.shThis writes flat-site-dist.tar.gz.
During the build, the generator creates optimized derivatives in dist/assets/images/ for:
- post and page feature images (with responsive
srcsetvariants) - Markdown image embeds
- raw local
<img>tags inside Markdown - the repeated header/footer background tile
Current presets:
- feature images: max width
1400px - inline content images: max width
1200px - background tile: max width
220px
The built pages reference generated derivatives automatically. Original source files are omitted from dist/ when a derivative replaces them.
static/is copied intodist/during the build.dist/andflat-site-dist.tar.gzare generated artifacts and are ignored by Git.- The Markdown renderer is intentionally minimal and supports headings, paragraphs, emphasis, links, images, lists, blockquotes, fenced code blocks, and raw HTML blocks.