Welcome to the new blog, very nearly identical to the old blog

Thursday, June 29, 2023

Comments: 9   (latest July 17)

Tagged: zarf, zarfhome, blog, blogger, gameshelf, python, mastodon, static site generators

Six years ago, I wrote a post that started:

Nine years ago I made my blogging debut with a post titled Games that don't exist.

-- "I'm shifting my bloggery to blog.zarfhome.com", May 27, 2017

That's a total of fifteen years, or about four and a half light-parsecs as the Falcon flies. Pretty good!

The news at the time (2017) was that I was shifting my blog off The Gameshelf (thanks Jmac) and onto my own site, blog.zarfhome.com.

That part hasn't changed! Here we still are at blog.zarfhome.com. But under the waterline it's a whole new duck.

See, I got tired on relying on Google's Blogger.com. Blogger works fine. Google hasn't cancelled it. They've barely even updated it. But, you know, Google might cancel it, or upgrade it with some fancy new "feature".

Also, Blogger.com wasn't friendly to Markdown. I write everything in Markdown. Converting that to HTML for Blogger was somewhat messy. I got tired of the corner cases.

So I exported all my blog data (thanks Google Takeout) and shoved it into a static site generator and here we are. 527 old blog posts and one brand-shiny-new one. Blogging will continue.


Some details:

  • All the old post URLs should still work. But the canonical URLs don't say .html any more. You can use tidy URLs (like https://blog.zarfhome.com/2023/06/welcome-to-the-new-blog) in the future.
  • The Atom feed is still https://blog.zarfhome.com/feeds/posts/default. However, I've lost the old Blogger GUIDs, so you'll probably see a flood of old posts in your feed reader. Sorry! It's a one-time thing, or at worst once every five or ten years.
  • There's an RSS-per-se-RSS feed too, but the URL has changed. It's now https://blog.zarfhome.com/feeds/posts/default.rss. Note: the RSS feed contains only article excerpts. The Atom feed contains full articles.
  • Formatting on old posts may be janky. The Gameshelf-to-Blogger-to-here pipeline was a bit of a mess.
  • I've imported all the comments from the old blogs.
  • New comments are... wait, how do comments work on an SSG site? Answer: Mastodon! Yes, you need to use Mastodon to comment now. I know this is a roadblock for a lot of you, and I apologize for this, but this just isn't a comment-heavy blog. The benefits of a static self-hosted system outweigh the convenience of the old comment system. See this page for more info.

So what's the software like? Answer: it's a hacked-together bit of Python. No surprise there, I guess.

Usually I love posting source code for my weird projects. I may yet post the source code for this one. But there's just not much to it. It reads in text files, shoves them through Markdown and Jinja, and writes out HTML. There's a little bit of work to assemble tag lists and archive pages, but nothing surprising. The whole thing is under 2000 lines of Python.

(The Mastodon-comment script is borrowed from this post by Carl Schwan. Thanks!)

The Python script is so simple that it regenerates the entire site every time I run it. Takes under a second. I intend to add a caching system so that it only rebuilds changed pages, but, cough cough, I haven't gotten around to that yet. Maybe when that works I'll post the source. No rush.

Really, the Python itself was about 5% of the effort of this site refresh. 25% was coming up with a nice clean page template. (Blogger's wasn't width-responsive at all.) The vast majority of the work was importing all those old posts! And the old images!

(You wouldn't believe how messy fifteen years of blog export can get. The posts were in hacky HTML, some with multiple layers of hack. Gameshelf used one scheme for uploaded image URLs -- until we broke it and started uploading all images to the root directory. Blogger used a different scheme, or rather three different schemes, including a fun period where the image URL didn't include the filename or the image type. Some of the images were at blogspot.com and others were at blogger.googleusercontent.com. I had to fetch them, regularize the filenames, reupload them to the new site, and then munge all the posts to clean up the <img> tags. I wrote a lot of throwaway munger scripts.)

If you want to run your own SSG blog, honestly, you don't want my code. Pick an existing system. I've used Pelican (for narrascope.org) and Metalsmith (for the IFTF site). Zola comes highly recommended too. Writing your own is purely a for-fun exercise -- hacking therapy. I needed some.


Comments from Mastodon


Comments from Andrew Plotkin