Skip to main content
A simple, flat-file blog system using PHP and Markdown. No database, no admin panel, just write and publish.

Writing on laptop

Concept

Frustrated with bloated CMSs, I built a minimal blogging system that uses Markdown files as the database. Write in your favorite editor, commit to git, done.

Architecture

posts/
├── my-first-post.md
├── another-post.md
└── latest-thoughts.md

Each post is a Markdown file with YAML frontmatter:

---
title: Post Title
date: 2024-01-15
tags: [web, programming]
---

Post content here in **Markdown**.

The Code

Dead simple PHP script that:

  1. Scans the posts/ directory
  2. Parses frontmatter from each file
  3. Converts Markdown to HTML using Parsedown
  4. Displays posts sorted by date
function parseFrontmatter($content) {
    preg_match('/^---\s*\n(.*?)\n---\s*\n(.*)/s',
                $content, $matches);

    $yaml = $matches[1];
    $body = $matches[2];

    // Parse YAML into array
    $meta = parseYAML($yaml);

    return ['meta' => $meta, 'body' => $body];
}

Benefits

  • Version Control: Every post is in git
  • Portable: Just Markdown files, import anywhere
  • Fast: No database queries
  • Offline Writing: Write without internet connection
  • Simple Deployment: rsync to server

RSS Feed

Auto-generated from the post files. Because RSS isn't dead.

Performance

With proper caching headers, pages load near-instantly. The entire blog can be served from a Raspberry Pi.