Monday, March 7, 2022

I'm switching my personal blog to self-hosting via Hugo

After putting a bit of thought into it, I’ve decided to start the process of switching my personal blog to self-hosting on Hugo instead of hosting through Blogger. This blog is staying where it is, but I’ve been playing with the Hugo framework for awhile and am finding I really enjoy it. Expect to see some posts about my experiences with it in here from time-to-time.

An image of the blog, showing new header style and list of entries

Why switch?

Even with the benefit of Google Takeout, moving blog infrastructure is time-consuming. So why have I bothered? A few reasons, in no particular order:

Tooling and control

Blogger’s UI hasn’t been updated in approximately ten years. It’s an acceptable WYSIWYG editor, but the resulting under-the-hood HTML is opinionated and has some weird formatting decisions. The editor also doesn’t support many keyboard accelerators, and it’s incredibly frustrating to have to break flow typing to go push a button to change style. In practice, I’ve been side-stepping the UI completely for weeks by writing blog posts in Markdown and copying-and-pasting the resulting HMTL directly into the raw editor view in Blogger. And I’m ultimately at the mercy of Blogger’s opinion of how layout should be done; some of my images overflow the content space, and I can either shrink them or leave that as-is.

Hugo lets me cut out the middle-man in that process; it renders directly from Markdown to HTML and the rendering can be reconfigured. The renderer is extensible via shortcodes that tap into the Go infrastructure under the hood. I’m doing most of my blogging in emacs now, and it feels great. In the future, I should be able to automate the flow of adding a post, recompiling, uploading to my server, and publishing updates.

Privacy, tracking, and censorship

Of all the reasons, this is the least significant one, but it bears mentioning: I think enough of my potential readers have come to care about the information-harvesting capacity of Google that I’d like to do them a solid and move off of a Google-hosted service. I’ll lose some of my analytics, and I have to support my own comments, but I think those are going to be exciting enough challenges to justify the cost. The recent rulings regarding Google Analytics and the GDPR seem to have some people backing towards the exits on that infrastructure anyway.

Google also has a bad habit (or good habit, if your goal is to combat spam and bad actors; I’m still enough of a company man that I see it their way too) of deciding you’ve violated their terms of service and blowing all your Google services out of the water as a result. I’ve already soft-firewalled the personal blog behind ownership by my non-primary account, but since it’s the “spicier” one, I run the risk that I’ll trip over Google’s constantly-evolving TOS some day, they’ll decide my primary and non-primary accounts are the same actor, and I’ll lose both. Moving the entire thing off to another host decreases the odds of that outcome.

Things I’ll miss

Not too many, it turns out.

Embedding images

One thing the WYSIWYG editor actually does do quite nicely is image embedding. The flow in Hugo isn’t as clean; I have to copy the image into a folder alongside the blog post and then reference the filename in the Markdown. That having been said, I strongly suspect I’ll be able to automate that process with a couple of emacs macros to turn it into fetching an arbitrary file, copying it into the right location, and adding the reference.

It turns out, embedding video is more straightforward in Hugo; there’s a shortcode for linking to YouTube (assuming I don’t just self-host the video content).

Will the old content be going away?

No. I don’t plan to add more posts to the personal blog, but I’ll be keeping it up so that hyperlinks don’t break. This will, in practice, fork comments, but I’ve decided I don’t care too much about that issue (comment load is low enough that it’s a non-issue).

How will you do comments on the new blog?

Great question! As a static site generator, Hugo’s engine doesn’t handle comments natively. Hugo integrates with a variety of comment engines, but after putting some thought into it and reading what others have done, I decided to just have people email me comments and I’ll embed them into the site. This doesn’t completely detach me from Google (my email service is GMail), but it gives users some confidence that I’m not dumping their information directly into the hopper.

Will I be moving this blog?

It’s possible, but I think unlikely in the near future. This one is heavier (including more images and more posts), and will take quite a bit more time. But if my experience with the personal blog goes well, we’ll see.

Where is the new blog?

The new blog is at http://personal-blog.fixermark.com. You can also subscribe to the Atom RSS feed.

6 comments:

  1. I made a number of feature additions to Hugo in 2013, to support my migration from Blogger to Hugo without breaking links. The exported blog-post markup did not render great inside the CSS framework I later ended up on, but I think it was less bad with the initial migration. I just figured I would reformat the old blog posts over time. Uh ... I finally finished that reformatting earlier this year.

    ReplyDelete
  2. Hey Mark! I did the exact same thing last year for basically the exact same reasons. It is surprising how similar your post is to the one I wish I'd written. I can report I'm pretty happy with it so far: git push to publish (on netlify), quick builds, nice markdown. I do miss being able to edit from any browser (or my phone) but w/e. I've got some lingering annoyances (didn't move all my photos over yet so there's still images stored on blogger via http :(, and I just bailed on comments too, but overall it feels much more me.

    It looks like you've got it figured out. But if you want to share our terrible scripts to parse Blogger's xml output or anything, email me. I'd love to see what you've done too if you've got anything you can share. (I have also recipe and music "blogs" that I probably hope to move someday as well, but haven't started on those)

    ReplyDelete
    Replies
    1. (this is Dan Tasse btw - ah, blogger, with its weird quirks like "blogger identities" that nobody ever updates!)

      Delete
    2. Hi Dan!

      More posts are coming on this topic. I'm glad to hear it's been working well for you!

      If you have an RSS link you want to share, I'd welcome it; I've been trying to extend my web of not-centralized-social-media blogs I read.

      Delete
    3. yes! back to the 2000s blogosphere!

      here it is!

      thank you for asking, it gave me occasion to check it, and I found that it was broken because I accidentally vimmed some weird character in a post about 5 posts back :P

      Delete