A Hugo Image/Photo Gallery

I recently switch this site from Wordpress to Hugo - and the site with Danish content too. It was mostly easy and straight forward, but initially there was a few features missing (by the very nature of it being a static site) and some things I needed to look into once the switch had happened. One of these was a gallery function to present images (photos mostly).

Gallery options….

There are various ways to have a gallery on a site, and one of the pains I had with wordpress, was changing strategies over time, which left me with several plugins needed to handle the historic gallery choices.

Batch converting JPG and PNG to WebP

I’ve been speed optimizing some of my personal sites, and one easy update is changing the images from being JPEGs and PNG images to the smaller WebP format.

All the images I need to convert are usually in collections, where one folder at a time needs conversion and as some contain a lot of images, I needed a way to do it smartly.

This is what I came up with:

For JPEGs

find . -type f -name "*.jpg" | while read file; do cwebp -lossless "$file" -o "${file%.jpg}.webp"; done

For PNGs

find . -type f -name "*.png" | while read file; do cwebp -lossless "$file" -o "${file%.png}.webp"; done

The one-liners find all jpegs (or pngs) in the folder and converts it into a lossless webp version. It leaves the original image as a backup. For further optimizations the “cweb -lossless” could be changes to:

Posting With Hugo

Switching to Hugo caused a major change in the workflow behind the site.

Wordpress comes with a full-featured backend which allows you to manage basically your entire website (if it’s Wordpress powered), but Hugo don’t. There’s no-backend admin site nor an webeditor to create and manage your posts. It doesn’t bother me. It’s a completely different workflow and I’m starting with a rough minimum flow initially untill I get a bit more expirence running Hugo.

Certificate check from Go

As the web moves more and more to HTTPS and ehanced security (such as HSTS) keeping your certificates updated and valid becomes more and more important.

I’m toying with an idea of building a small webapp to monitor my small portfolio of certificates and warn me if a certificate is due to expire. As part of this, I’m slowly patching pieces together in Go and one of the small useful outcomes is a small (compilable to bin) script which prints the basic certificate details of a given domain.

Moving content from Wordpress to Hugo

Going from one CMS to another can be huge challenge - especially as I wanted the various pieces I’ve managed to bring along from the past 20 years along (content from the first years of the site is sadly lost over time).

Getting content out of Wordpress

Getting content out of Wordpress is quite easy. It has a built-in export function and while it took some time, resulting in a large zip file. As Wordpress powers huge parts of the Internet, the export format is well-understood and documented so it only to a little time to find a tool which could do a conversion from the Wordpress export to Marked which is what the Hugo CMS wants.

Moving from Wordpress to Hugo

This site has been running for 20+ years. Most of the years I’ve been using wordpress to post occasionally and have fun messing around.

Wordpress have been a moving target and gained more features through the years. Far more than I ever needed, and to keep simple I’ve decided to move to a simpler setup using the HugoCMS.

Getting to here

One of the benefits of Hugo is, that it’s easy to have it running locally and rapidly let you see changes and update you make to hugo configuraion, themes and content - and I’ve even used it across Linux and MacOS during migation.

Technical Tips for video meetings

It seems a lot of people have already written a lot on the etiquette of video meetings, so in this little post, I’ll try to contribute with some of the technical tips which doesn’t seem to be covered as much.

Network connection

While wifi seem to work fine mostly, it can cause issues. If you have the option to use a wired connection for you device used for videomeetings, do so. It will have less latency then any wifi-connection and improve the experience.

Automatic MacOS shutdown

From time to time my Mac is doing stuff which takes quite awhile. Converting images, converting videofiles between formats or other stuff, which may take a long time (but reasonable predictable).

In those cases I run a little command in the terminal, to automatically shut down the Mac upon completion:

sudo shutdown -h +120

This command sets a timer which shutdown the machine after two hours (the 120 parameters being after 120 minutes).

No access to *.dev sites

I’ve been having an odd issue for a couple of months. When accessing sites having a .dev domain (like most recently go.dev), I my browsers have given me warnings and as many had HSTS-headers, not allowed me to visit the site.

It seemed like a strange error, and I’ve tried to remember if I’ve set up some proxy or VPN connection, that could cause this issue. A few times I’ve asked others on the net if they had issues - which was not the case - and I’ve tried using a web proxy, and everything worked. Yet no matter which browser I used it didn’t work.

Ubuntu 16.04 to 18.04 TLS...

The site went offline a few hours today. Sorry.

It turns out Ubuntu once again changed a major component and the upgrade path didn’t work as it should to keep the lights on after the upgrade.

I’ve been updating the security settings on the server all around, and one of the things I wanted to do was adding TLSv1.3 support (and nothing before TLSv1.2). For that I needed, it seemed the best option to push forward the Ubuntu server version to the newer LTS version (18.04) and as part of this get a newer NGINX with TLSv1.3 support. That part worked sort of great.