Hugo to the Rescue

Friday, February 7, 2020

In January I rebuilt my custom blog engine running on .NET Core 3.1. I pushed it up to a new Linux server in Azure. Everything appeared to be okay. So I left it and hoped I’d have the motivation to write some blog posts for it. Yesterday I wanted to see how to do CompactOverlay in JavaScript. I know I have a blog entry on that. I’ll just go to my website and find it. However, I got a dreaded message that the server wasn’t running. More specifically it was acting like it was never setup. Very confusing.

I started building static sites last July when I created a site for my family’s recipes. This site is just a JSON file for data and a single page app for the display. Very basic. About a month ago I rewrote my theTodd.com web site using Hugo. The process was very straight forward. I wrote a simple Python script to take the XML backup of the site and output a bunch of Markdown files. I then massaged the markdown to remove the remaining HTML and the site was done!

Anyway, back to this site. Panicked, I quickly checked the database and it was running just fine. So I grabbed a backup of the data and began the task of rewriting this blog using Hugo. I rewrote the Python script to take the RSS output of this site and output markdown. Then I massaged the markdown to remove the remaining HTML just like I did with my other site. Finally, I tracked down a backup of the images that were used in the old site and put them in the appropriate blog entries here. Finally I uploaded the whole thing to source control.

Now, I have a trigger on source control that builds the Hugo static site and copies the public folder to Azure Blob Storage. Blob storage has a CDN in front of it and that’s how I serve this site! It’s the same infrastructure I use for two other sites now and it’s really handy.

HugoWebsiteJAMStack

Hugo Page Resources

6502 Computer