Matt Mayes

Currently a senior developer at HighWire Press, where I regularly work on and maintain sites that receive millions of unique page views a month. Also a lover of music and bbq. More »

Latest Posts

Fun With Pi-hole and Raspberry Pi Nov 22, 2020 A Raspberry Pi sure is a handy thing to have around - not only to tinker with but also when you need a 24⁄7 server on the cheap to do things like cron jobs, act as motions detectors - or in my case, make a DNS Sinkhole with Pi-hole. After setting this up, not only am I enjoying quicky disposing of ads, but also the faster loading of web pages. ...
Site Now on Github :) Oct 15, 2020 I’ve received a few requests to make this site fully available on github, and now it is! You can access it here: https://github.com/stoptime/mattmayes-hugo Have a look around, and if something seems wrong in my content or anything else, please raise an issue or PR. Thanks for the interest!
Making Hugo Even Faster Jan 4, 2020 UPDATE this site is now on Netlify, which is frickin’ awesome (and free for basic sites) but if you’re on another host, especially one that uses Apache, this might help you. We all want our mobile PageSpeed Insights score to be in the 90s right? There’s more to it than tossing on that old flannel, here are some things that helped me. Take advantage of Free Cloudflare Cloudflare has a free plan that can really boost your site by handily taking care of things like minification, serving your site over HTTP/2 or even HTTP/3 when possible, “Page Rules” you can use to cache the heck out of those static assets, Brotli compression (the safe version of gzip for https connections); their Rocket Loader™ improves paint time for pages that include javascript - not to mention their free and easy HTTPS and everything is on their CDN. ...
JavaScript Arrow Functions and 'this' Dec 27, 2019 One of the things that makes JavaScript so interesting (and weird) is not only the various ways to write an arrow function, but how ‘this’ behaves within one. The paricular part I find interesting is that arrow functions don’t have their own this - rather, they inherit this from the invocation context that calls them, aka their outer function. Maybe That’s a Strength? We can use that knowledge to get around some dodgy problems. ...
Hugo: Add Handy Css Classes to the Body Tag Dec 19, 2019 It is so handy to have some css classes on the <body> tag. When working in Drupal, I like to at least have the content type as a css class, “article” or “page” or whatever. In Hugo, I also put the content type as a class on the <body>, as well as the filename/path, like so: <body class="{{ .Type }} {{ with .File }}{{ .TranslationBaseName }}{{ end }}"> In the hyde-hyde theme this is done in the baseof. ...
Hugo Rsync Deploy and Htaccess Dec 18, 2019 Deploying this site to my WebFaction account was super easy, I pretty much just followed the Hugo docs for rsync deployment, with one minor change to minify the html output: #!/bin/sh USER=your-username HOST=your-username.webfactional.com DIR=webapps/your-app/ # the directory where your web site files should go hugo --minify && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} exit 0 Note the --minify flag after hugo, which will make your pages even more performant by minifying the the html output. ...
Hugo: How to Properly Add Custom CSS Dec 16, 2019 UPDATE: This works the exact same way with scss - on this site I just updated my config.toml to point to scss/custom.scss. So you’ve picked out and installed your Hugo theme, but you just need to tweak a few things here and there, yet you don’t see a config setting that allows you add your own css file(s) in config.toml 👎 In addition to adding your own css file, wouldn’t it be great if they were minimized and had the integrity set too? ...
Hugo and Wrangling Hyde-Hyde Dec 15, 2019 So I’m just getting started with Hugo, and decided to go with, and tweak, a classic theme: hyde-hyde. Off the bat, while the hugo docs are good - here’s a few things that helped things click for me. When you just run hugo - it creates a public directory, and this is where your files are served from (and what you would upload to a host). If things seem off or just weird, look for this directory and if exists, delete the whole thing - it’s easy to recreate by just running hugo again. ...
Rename and Sanitize Files in a Directory with Golang Dec 14, 2019 Sometimes you need to rename and “sanitize” a bunch of files in a directory. For me, I had to do things like: - Remove spaces. - Remove apostrophes, commas, etc - In some cases, remove a trailing “-” Seemed to be a perfect opportunity to get to know golang a little better. Hat-tip to this helpful page on working with files in golang. Just be sure to change the directory to the one you want. ...