← Home

Building atomik-ssg — A Static Site Generator in C

The Core Problem

Static site generators sound complex. They aren't. At the core, every SSG does three things:

  1. Read Markdown files
  2. Convert them to HTML
  3. Apply a template

Everything else — themes, config, CLI, RSS — is built on top of this foundation.

Markdown Parsing

i used cmark, the reference implementation of CommonMark in C. The entire conversion is one function call:

char *html = cmark_markdown_to_html(
    content, strlen(content), CMARK_OPT_DEFAULT);

Clean, fast, standards-compliant.

Frontmatter

Every post starts with a YAML-like frontmatter block:

---
title: My Post
date: 2026-08-10
slug: my-post
description: A short description
---

i wrote a simple parser that reads line by line, splits on :, and populates a Post struct. No external library, around 50 lines of C.

Template Engine

Our template engine is intentionally minimal. It scans the template string character by character and replaces {{placeholder}} tokens with actual values.

No loops, no conditionals, no filters. Just substitution. For a blog, that's all you need.

What i Learned

Writing a tool you actually use forces a different kind of thinking. Every decision has a consequence you feel immediately. The CLI is awkward? You feel it every time you run it. The build is slow? You wait for it.

atomik-ssg is the result of building something i wanted to exist.


If you found this useful, the source code is on GitHub.