Website Optimization Measures, Part XXX
Published on Mar 3, 2025, filed under development, optimization (feed). (Share this on Mastodon or Bluesky?)
Part 30!âof an article series in which I share improvements and lessons from the work on my own projects, enabling you to pick what you think could benefit yours:
Trimming input. I work with homemade (and not necessarily AI-made) tooling for some of my projects. For one, I noticed a minor but still annoying issueâoccasionally, data input would have trailing spaces at the end, spaces I wouldnât catch. Once this had my attention, the fix was simple, given that the tool used PHP:
trim
.Always cleaning up a little⌠Well!âI added this after weeks of not adding anything to the draft of this entry, but constantly updating my projects (current GitHub contributions count for the year, as of Feb 15: exactly 2,500). Today, for example, I found some tiny irregularities in my Eleventy templates, as in two Nunjucks files that were marked as âhiddenâ but didnât really need to be hidden. This isnât something to list here⌠and yet tonight, still on Feb 15, I like to add this note given how very much, web design and development are a process. (I know that you know, but grant me the pleasure of spelling out the obvious.)
Updating WordPress ping services. Setting up a new (AI-related) project to play with, I noticed that WordPress only offers one ping option nowadaysâhttp://rpc.pingomatic.com/. Two things were interesting about this: The ping list of another WordPress site of mine included 20+ ping services⌠which I tested and saw fail entirely. Even researching new ping lists led to only one ping service, said one on pingomatic.com. So this I updated. The other thing? Reporting and submitting a fix PR for that http URL (and then learning about an existing PR that was⌠still not merged).
Cleaning up Eleventy page locations. Keeping a slightly longer story slightly shorter, I noticed that most of my Eleventy main pages were under /pages (which seems to be some sort of convention?), but that there were a couple of outliers. These I movedâwhich, kind of making this a two-in-one optimization, led to noticing how some pages were hidden (from sitemaps) that shouldnât be. I suppose there really is a point to this series, encouraging always to look out for things to improve đ
Allocating a new category for redirects set up to capture user errors. Since 2008 have I been working with a particular and to me proven structure for my .htaccess files, including a prioritization system for redirects. For the longest time, I set up redirects to capture hits on non-existing URLs in this system. To better differentiate between redirects I set up and those somewhat pushed on me, I included a new âcourse correctionâ category, âuser input.â That is, in Apache configs for my projects I created a section just for redirects for resources that never existed but that keep getting traffic.
Synchronizing server log configurations. Over moving around some domains I had missed a detailâthat for every domain, I had some extra rules in place for server log configuration (for example, to filter certain file types). This configuration was not the same for all domains now, and hence in a manual effort, I updated all config files. (I suppose thereâs no automatable way of doing something like this on shared hosting?)
Replacing dependencies like chalk and yargs by native functionality. I loved running into Brian Muenzenmeyerâs Do I Need This Node Dependency? (when scouting for Frontend Dogma, of course!), prompting me to look for and axe some of the mentioned dependencies. An excellent refactoring benefiting both Imagemin Guard (try it using npx!) and ObsoHTML and all their users. Great stuff.
Adding minimal dark mode to raw pages. I believe the most minimal dark mode code still to be what I described in Minimal Dark Modeâwith one exception: unstyled pages. On those, the most minimal code would go into the HTML, and itâs the following line:
<meta name=color-scheme content="light dark">
I implemented this on two subdomains, Mirrors and Hell, and, it works.
Unfancying error pages. On said subdomains, Iâve used pretty simple error pages that I defined in each subdomainâs .htaccess. They were still somewhat âfancy,â and inconsistent with those barebones homepages. I cleaned up, leading to the code I may as well share here (especially if you havenât used the
ErrorDocument
directive like this yet):SetEnvIf Host ^ suppress-error-charset ErrorDocument 401 '<!DOCTYPE html><title>Unauthorized</title><meta charset=utf-8><meta name=viewport content="initial-scale=1,width=device-width"><meta name=color-scheme content="light dark"><h1>Unauthorized</h1><p><a href=/>Home</a>' ErrorDocument 403 '<!DOCTYPE html><title>Forbidden</title><meta charset=utf-8><meta name=viewport content="initial-scale=1,width=device-width"><meta name=color-scheme content="light dark"><h1>Forbidden</h1><p><a href=/>Home</a>' ErrorDocument 404 '<!DOCTYPE html><title>Not Found</title><meta charset=utf-8><meta name=viewport content="initial-scale=1,width=device-width"><meta name=color-scheme content="light dark"><h1>Not Found</h1><p><a href=/>Home</a>' ErrorDocument 500 '<!DOCTYPE html><title>Internal Server Error</title><meta charset=utf-8><meta name=viewport content="initial-scale=1,width=device-width"><meta name=color-scheme content="light dark"><h1>Internal Server Error</h1><p><a href=/>Home</a>'
This is a part of an open article series. Check out some of the other optimization posts!
About Me
Iâm Jens (long: Jens Oliver Meiert), and Iâm a web developer, manager, and author. Iâve been working as a technical lead and engineering manager for small and large enterprises, Iâm an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for OâReilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)