<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>MidLifeCoder</title>
    <link>https://midlifecoder.co.uk/</link>
    <description>Coding, tools and the occasional detour, written by a mid-life dad.</description>
    <language>en-GB</language>
    <lastBuildDate>Wed, 02 Dec 2026 16:21:10 +0000</lastBuildDate>
    <atom:link href="https://midlifecoder.co.uk/feed.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>Why I Built a Custom Python Static Site Generator for Obsidian</title>
      <link>https://midlifecoder.co.uk/blog/how-i-update-this-website-part-1/</link>
      <guid isPermaLink="true">https://midlifecoder.co.uk/blog/how-i-update-this-website-part-1/</guid>
      <pubDate>Mon, 10 Aug 2026 00:00:00 +0000</pubDate>
<category>python</category>      <description>Tired of heavy CMSs? Here is why I built a custom Python static site generator tailored specifically for Obsidian notes and simple blog hosting.</description>
      <content:encoded><![CDATA[<p>So this website is a "static website" (see the box below for what that means) but since it is my blog site I need a way to add posts that doesn't involve writing the code for every page. How do I do this?</p>
<h2 id="enter-the-static-site-generator">Enter the "Static Site Generator"</h2>
<h4 id="what-is-a-static-site-generator-ssg">What is a Static Site Generator (SSG)?</h4>
<blockquote>
<p>"An SSG is a build tool that takes raw content files (like Markdown) and templates (like Jinja2 HTML), parses them, and compiles them into pre-rendered, static HTML files ready for static web hosting."</p>
</blockquote>
<p>This is not a new idea and a quick search will provide you with many different options of variable difficulty and codebase but for me, as a tinkerer, I built my own in Python.</p>
<p>Why build your own you might be asking?
Because the fundamentals of a Static Site Generator (we will call it an SSG from now on) are very basic:</p>
<ul>
<li>Write your posts in a format that can be converted to HTML (in most case MarkDown).</li>
<li>Save them in a pre-defined folder structure.</li>
<li>Point the SSG at your folder of posts (and pages).</li>
<li>Specify your layout template (the design and structure of the website).</li>
<li>Press "build" (or whatever the command is).</li>
</ul>
<p>The SSG will then read all the posts and pages, follow your predefined rules to create the site structure, convert the markdown to HTML and spit out a website you can upload to the internet.</p>
<p>The main differences between the multiple SSG options are </p>
<ul>
<li>the language it has been built with (Python, PHP, Rust etc.)</li>
<li>the speed with which it outputs a site</li>
<li>the details of what template system to use</li>
<li>what forms of markdown to support (including what other source formats it could use) and if it can be extended with plugins or code to accommodate your exact requirements.</li>
</ul>
<p>Since I want to write my Markdown and save my files in Obsidian my biggest requirement is the ability for the SSG to convert all (or most) of the peculiarities of the Obsidian Markdown format.</p>
<p>So rather than test lots of different SSG's and get lost in all their configurations and idiosyncrasies I decided to write my own.</p>
<p>I know Python quite well and there are packages that will help such as [Jinja2](https://palletsprojects.com/projects/jinja/] for templating, markdown2 (and a few others) for creating reusable templates and <a href="https://github.com/trentm/python-markdown2">markdown2</a> for converting the most common markdown to html so I can get 90% of the hard stuff done for me.</p>
<h2 id="why-a-static-website">Why a static website?</h2>
<p>This is a question that every website creator will ask themselves.</p>
<div class="callout callout--info" data-callout="info"><div class="callout-title"><span class="callout-icon" aria-hidden="true"><i class="fa-solid fa-circle-info"></i></span><span class="callout-title-text">Info</span></div><div class="callout-content"><p>Static websites are fast, secure, free and need minimal server resources BUT they can be a pain to create and update information because of their "static" nature.</p></div></div>
<p>Dynamic websites can be nearly as fast, nearly free, easy to update and nowadays can run on very limited server resources BUT they need work to keep secure (keeping the core and plugins up to date).</p>
<p>WordPress would be an ideal choice as a dynamic website as it is free, well supported and well known and I already use it for most of my clients sites.</p>
<p>So why go static? Because for a basic blog I only need about 10% of what Wordpress offers and I wanted to create an SSG so what better site to test it with than my own blog!</p>
<p>This is the how I created this site and the why I chose this path, the next posts will detail the different aspects of bringing it all together.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>