Website Optimization Measures, Part XXX

Published on March 3, 2025, filed under (RSS feed for all categories).

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:

  1. 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.

  2. 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.)

  3. 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).

  4. 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 đŸ˜‰

  5. 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.

  6. 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?)

  7. 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.

  8. 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.

  9. 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 posts!

Was this useful or interesting? Share this post (e.g., on Mastodon or on Bluesky), and support my work by learning with my ebooks!

About Me

Jens Oliver Meiert, on November 9, 2024.

I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve worked 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.)