Baking Static Sites with Python and Jinja

Matt Harzewski
The Startup
Published in
6 min readMay 30, 2020

--

I have long been a proponent of static site generation, even before the (relatively) recent wave of tools like Jekyll, Hugo and Gatsby. In the pre-WordPress blogging world, having an engine such as Movable Type or the original Blogger.com churn through your content and produce plain old HTML files was the norm. It made sense; after all, the basic principle of a content-driven web site is an author pens an article once in awhile, and users do little beyond reading that content. Why waste time building the page on every request, slowing everything down, when your web server can throw back thousands of static files per second?

The advantages of generating blogs and other sites that change infrequently (marketing sites, documentation, etc.) are well known and often talked about. You can shed complexity and hosting expenses, and it becomes easier to handle backups or archival. There is a multitude of tools available to solve this sort of problem.

However…what about sites that aren’t a collection of content written by humans? Perhaps you have some sort of semi-dynamic content that is collected and presented by an algorithm without human intervention. However, the content doesn’t change very often, so it theoretically would be advantageous to write the page once and let the web server do the heavy lifting. One example might be an aggregator like Alltop or Dave Winer’s “River of News” concept. You only check feeds every so often, and then could generate out a static web page. Or maybe you want to write a bot that watches…

--

--