Optimization Prime

Posted on: 15th December 2020

This blog is hosted on a Raspberry Pi and one of my aims is to keep it as light as possible. That involves keeping a clean HTML and CSS without resorting to minifying it (readability is also important). Reducing divs, inline styling, clearing out whitespaces, staying away from JavaScript, beautifying with as little CSS as possible were the techniques I used when launching this static site. It helped that the HTML and CSS were very sparse to begin with but then I saw 512kb.club and how lean every other site listed in there is and that started an itch to optimize even more. Its easy to direct the user to a very clean home page and hide the bloat but 512kb club has some very good examples of minimal home pages. Even the 512kb club home page is so well designed that the HTML size comes to just 20.7KB.

Validating against the W3C Markup Validation Service showed two <div> tags that were under <ul> and shouldn’t be but apart from that I have no idea how to reduce the HTML size as most of it is handled by Jekyll. The minimal CSS template used was good but I made it worse in the pursuit of a coherent design for light and dark theme 😅️. Clean-CSS helped clean the stylesheet a bit but I think it can be optimized even more without compromising the style or readability.

Another completely irrelevant but annoying issue was the error 404 for the favicon. I am not a brand or an organization or somebody famous to have a signature design or logo. Favicon doesn’t serve me any purpose. My occasional visitors don’t bookmark my website or save it on their desktop/mobile. Favicon web request, albeit small, is an overhead that can be eliminated. Stackoverflow proved helpful in this regard and I learned how <link rel="icon" href="data:,"> can eliminate the failed request without uploading any favicon.

These optimizations are akin to shaving off a stubble instead of a beard but they make my site efficient bit by bit. The total page size is now 3.67KB (before publishing this post) according to this latest report from GTMetrix.

Day 60 - Join Me in #100DaysToOffload

tags: 100daystooffload css pi selfhosting