Reading Markdown at build time

A small front matter parser, goldmark for the body, and drafts that never reach the list.

Each post is a Markdown file with a short header. The server parses every file once at startup, converts the body to HTML, and keeps the result in memory.

A dark placeholder card reading Markdown at build time

The front matter

The header is a few key: value lines between two --- markers.

---
title: "Post title"
date: 2026-11-17
description: "One sentence summary."
tags: ["web", "ctf"]
draft: false
---

A post is skipped when draft is true. It is not in the list, and its URL returns the same 404 as a path that never existed.

A dark placeholder panel showing the work done at startup

The body

The body goes through goldmark with no extensions. That means plain CommonMark: headings, lists, links, code blocks. No syntax colours, no table of contents.

Images are the one exception. They are rewritten so a bare filename points at the post's own media folder, and the real pixel size is added to the tag.

Why parse once

Parsing on every request would put a file read and a Markdown pass in front of each view. Doing it at startup keeps the request path simple: look up a slug, render a template, write the response.

Work you do once at startup is work the reader never waits for.

Back to all posts