WordPress to Hugo Update V
It's time for another quick update on the site's transition from WordPress to Hugo.
Since the last time we touched this particular topic, I haven’t moved any of the semi-dynamic content like I thought I would. But fear not. It’s all still there, just hosted by WordPress. What about browsing the ever-growing collection of funny and thought-provoking one-liners?
Instead of getting A Picture A Day, A Book A Month, and the aforementioned one-liners out of the clammy, clinging grip of WordPress, I did a lot of work under the hood:
- The majority of the 2,500+ Markdown files are now free of linting errors. My most effective tool when doing that was regular expressions, and my proudest moment was without doubt this one:
^(.+(?!\n))$. It finds every line that contains one or more characters, but doesn’t end with a line break character. Yeah, my regex-foo isn’t that impressive.
- Pagination is now working properly. Initially, there was no pagination support in the theme I’m using, Hello Friend NG, but it only took a couple of hours to get it working.
- With the help of Hugo’s Markdown render hooks, I added a nifty little detail to all the external links: If it’s a Wikipedia link1, you’ll see a wikipedia logo, and if it’s another external link you’ll see a symbol for that as well. The Wikipedia logo is useful for those of you who want to dig further down in a topic I’m mentioning, and the external link flag is great for those of you who don’t trust external sites. I probably should write a post about how I did this.
- The site now saves some visitor stats. I’m only saving accumulated visitor numbers per page. No IP addresses, cookies, device fingerprinting or anything like that is involved.
As I continue to work with Hugo, I’m liking it more and more. The only feature I’ve missed so far is a good way to create archives per month and year. There are some hacks that can be used, but I think I’ll wait a while and see if Hugo comes out with native support. The release frequency is pretty high, so it might suddenly happen. Or I could give Go a go2, and make a pull request.
I’ve also been digging through a bunch of old backup CD-Rs and external hard drives. On one of the CD-Rs, I managed to find some old posts that weren’t in the archive. The oldest post was from back in 1999, which I though was pretty damn awesome to find. Back then, I didn’t write titles for any of the posts, so I had to add some arbitrary titles now. But apart from that, everything is posted in its original, cringeworthy form, with spelling errors and all.
So, yeah, the site is in pretty good shape. The next big thing is either to move A Book A Month over, or to set up a system where I can automatically ping external sites, like Twitter, Mastodon, and the Internet Archive when I publish new posts. I’ve got a basic idea of how this can be solved, but I think I’ll search the internet for some suggestions. I’m sure this is a problem someone else has solved already.
This post has no feedback yet.
Do you have any thoughts you want to share? A question, maybe? Or is something in this post just plainly wrong? Then please send an e-mail to
vegard at vegard dot net with your input. You can also use any of the other points of contact listed on the About page.
It looks like you're using Google's Chrome browser, which records everything you do on the internet. Personally identifiable and sensitive information about you is then sold to the highest bidder, making you a part of surveillance capitalism.
The Contra Chrome comic explains why this is bad, and why you should use another browser.