Static sites are fast, we all generally agree to that, but they could be faster… One way we can achieve this is through a good service worker led caching strategy, for example, pre-fetching resources that the user is likely to need in the near future, such as the next few pictures in a photo album. In this post we’ll walk through how to build out a basic service worker for a Hugo website (which is largely similar to the use of service workers in any other context).
Over the course of the past several weeks as I’ve made the transition from dynamic (WordPress) to static (Hugo), I’ve been looking at ways I could not only decentralize social, but also build that overarching objective into the fabric of this site. Here enters webmention, a W3C recommendation as of January 2017. So what exactly is webmention? Well, as defined by the W3C, webmention is a simple way to notify any URL when you mention it on your site.
UPDATED 4/22/2022 A few months ago I posted on using Algolia Search with Hugo. As mentioned in that post, I currently use Lunr to serve the purposes of search on this site and am finally getting around to posting how to pull together the two. Lunr, unlike other search services, has no external dependencies and works either within the browser or on the server with node.js - at its core it’s a small, full-text search library for use in the browser.
Over the past month or so I’ve been working more and more with Hugo as I rebuild and consolidate my old dynamic sites see https://wbaer.net/2020/12/going-static/. At the onset I had initially elected Nova App as my preferred editor of choice, but most recently have started using Visual Studio Code. With Nova I had a shell script I would run in Terminal (macOS) when developing my site, but now that I’m using Visual Studio Code I decided to use tasks.
This is more or less a continuation of my previous article on moving to Hugo from Wordpress. When it comes to search and static site generators such as Hugo, there are a seemingly unlimited number of options available to you - one of most popular I researched was Lunr, and while I temporarily opted to leverage Algolia to support search on this site, I ultimately decided upon Lunr. That said, while Lunr supports my needs right now, I’m hoping someone will find some benefit out of how to use Algolia with Hugo (easily).
You’ve probably noticed some changes around here over the last couple of days. After 15 years of maintaining my blog and 20 of maintaining this domain I’ve decided to consolidate the two - my “splash” page at wbaer.net and blog at blog.wbaer.net. For the last 15 years I’ve maintained my “technical” blog on TechNet or more recently (with the sunsetting of TechNet blogs a while ago) on Wordpress.com. Wordpress.com at the time was more or less the proverbial “path of least resistance" since TechNet had transitioned from Telligent to WordPress several years ago - making the migration options an easy decision.