Denpa@DenDen Garden 

How this site works

This site uses a custom static rendering engine built in Python to parse and generate pages. At its core, it takes in raw markup, parses a block of frontmatter into a combined site and page context, and then outputs templated HTML files for each page.

This approach isn't entirely dissimilar to Jekyll, currently in use on my blog, but offers a few personal advantages:

Generating pages

The site directory is walked through looking for all index.* files. Based on the file's extension, like .py or .html, the file is then sent to an accompanying rendering hook. For .html:

# TODO

For .py:

# TODO

The site's generate layer by default walks the entire site directory and creates every page, but also supports targeted builds. With a local server serving the pages and listening for create or modify events on files, it's possible to build specific paths or targets, much like Jekyll in a development environment:

class RebuildHandler(FileSystemEventHandler):
    def __init__(self, watch_dir, output_dir):
        self.watch_dir = os.path.abspath(watch_dir)
        self.output_dir = os.path.abspath(output_dir)

    def on_modified(self, event):
        abs_path = os.path.abspath(event.src_path)
        if abs_path.startswith(self.output_dir):
            return
        run_build(abs_path)

Page frontmatter

Frontmatter is defined in a block comment at the beginning of each index.html file, injected into the page's context during parsing:

<!--
PAGE_TITLE: How this site works
META_DESCRIPTION: 
PUBLISHED_TIME: 2025-06-01
-->
<p>This site uses a custom static rendering engine built in Python to parse and generate pages. At its core, it takes in raw markup, parses a block of frontmatter into a combined site and page context, and then outputs templated HTML files.</p>

These injected values can then be used to build out template strings like meta tags or page headings. With index.py files, context can be assigned in the class or imported from defined in an accompanying index.html.

# TODO: Expand these sections

Templating

Template strings and layouts (category pages)

Entry points

Page class

Scheduling

Collections, feeds

Feeds

Based on tags in commit history

Niceties

Minified HTML, quick generate layer, easy expansion

Caveats

Many!