Jared's Blog

About  Contact


Introducing blog.py


After years of failing to blog, I finally decided to write my own static site generator. I write blog posts in a Markdown-like syntax, then run a Python script to convert that into HTML files. Many hosting companies will host a static site like this for free. I picked Cloudflare, since it is free and widely used.

Writing a post


Adding a new post is as easy as adding a new post_title.md file. Here's a test post:

$$config
title = A second blog post
date = 20251010
$$preview
A second post for this blog.
$$content

# My Cool Post
hello, this is a post.

Here's a link to [google](https://google.com)

Here's a picture
![this is the caption](img/ps2.png)


The Python script will search through all post files, converting the content from the post files to HTML. The config and preview sections are used to generate a link to the post on the front page.

There are only a few features supported:


class Foo {
  public:
    Foo() = default;
};


Dependencies


I wanted to keep dependencies as minimal as possible. In the end, I caved and decided to include something outside of the Python standard library - a syntax highlighting library called pygments. The library has been around since 2006 so it seems like a safe bet.

In the end, the full list of imports for the site generator is pretty minimal:

import sys
import os
import re
import shutil

import pygments, pygments.lexers, pygments.formatters


A History of my blogs


One of the reasons I've struggled to blog over the years is because I can't find a good platform for blogging. I've tried pretty much everything. My first blog was hosted on some computers in my dorm room, running a WordPress knockoff that I've since forgetten the name of.

the blog was hosted on one of these computers
the blog was hosted on one of these computers


I later switched to Google Blogger, which was easy to use, but I always struggled to get text and pictures to line up the way I want. On top of that, there's barely been any new features in years, so I'm betting Google will end up killing it eventually, like they have done with many services.

I also tried static site generators like jekyll and even a full CMS like WordPress, but those are overly complicated and full of fragile dependencies. I followed the instructions to "Get up and running in seconds" to try to revive my old Jekyll blog, but there's a Ruby stacktrace with some permission error. Instead of spending the 10 minutes to untangle my Ruby installation, I decided it was better to just write my own generator in Python.